Re: issues simply parsing a whitespace-delimited textfile in python script

2008-05-21 Thread Paul McGuire
On May 21, 10:59 am, Damon Getsman <[EMAIL PROTECTED]> wrote: > I'm having an issue parsing lines of 'last' output that I have stored > in a /tmp file.  The first time it does a .readline() I get the full > line of output, which I'm then able to split() and work with the > individual fields of with

time module question - time zones

2008-05-21 Thread Eric Wertman
I tend to deal with dates a lot in different formats and places... typically I'll convert them to a time tuple with strptime(), and pass them around like that before I need to write them back out. One set of time/dates I'm getting are in UTC, but the string doesn't say that specifically. So I do

[no subject]

2008-05-21 Thread ahmed khattab
unsubscribe me form python list plz -- http://mail.python.org/mailman/listinfo/python-list

Re: Python's doc problems: sort

2008-05-21 Thread Xah
alex23 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 hominem accusations of elitism aimed at the module

Re: Python and Flaming Thunder

2008-05-21 Thread Daniel Fetchinson
>>> 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 "input.txt". >> If data is an error then go to

Re: [ctypes] convert pointer to string?

2008-05-21 Thread marek . rocki
Neal Becker napisał(a): > In an earlier post, I was interested in passing a pointer to a structure to > fcntl.ioctl. > > This works: > > c = create_string_buffer (...) > args = struct.pack("iP", len(c), cast (pointer (c), c_void_p).value) > err = fcntl.ioctl(eos_fd, request, args) > > Now to do the

Re: [ctypes] convert pointer to string?

2008-05-21 Thread Thomas Heller
Neal Becker schrieb: > In an earlier post, I was interested in passing a pointer to a structure to > fcntl.ioctl. > > This works: > > c = create_string_buffer (...) > args = struct.pack("iP", len(c), cast (pointer (c), c_void_p).value) > err = fcntl.ioctl(eos_fd, request, args) > > Now to do the

Re: Newbie: Keep TCP socket open

2008-05-21 Thread Alan Wright
You must have something in your IPtables I needed to put a rule in to drop these unwanted RST from getting back out. All fixed now Thanks for the advice Alan "Alan Wright" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Same on FC8, sends RST after it sees SYN/ACK > > "Ghirai" <

Re: Newbie: Keep TCP socket open

2008-05-21 Thread Alan Wright
Thanks Roy, will give it a go. infact there is no need for any IT phone calls, I am the owner of this network Very simple [bunch of clients][box under test][bunch of servers] Now i should be able to hammer them ;) Alan "Roy Smith" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROT

Re: time module question - time zones

2008-05-21 Thread Eric Wertman
Sorry, my time zone is +4, not minus 4, which means that something else is causing my source data to be in the future. I still do need to understand where the time routines determine the time zone offset, so I can be sure I'm passing around the neutral value. Thanks! On Wed, May 21, 2008 at 12:

Re: Python and Flaming Thunder

2008-05-21 Thread Dan Upton
On Wed, May 21, 2008 at 12:33 PM, Daniel Fetchinson <[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

can someone with guessing a number

2008-05-21 Thread garywood
I would just like the program to exit after guessing the amount of numbers wrong # Guess My Number import random the_number = random.randrange(100) + 1 tries = 1 # guessing loop while (guess != the_number): if (guess > the_number): print "Lower..." else: print "Higher..

Re: [ctypes] convert pointer to string?

2008-05-21 Thread Neal Becker
[EMAIL PROTECTED] wrote: > Neal Becker napisał(a): >> In an earlier post, I was interested in passing a pointer to a structure >> to fcntl.ioctl. >> >> This works: >> >> c = create_string_buffer (...) >> args = struct.pack("iP", len(c), cast (pointer (c), c_void_p).value) >> err = fcntl.ioctl(eos_

Re: issues simply parsing a whitespace-delimited textfile in python script

2008-05-21 Thread Damon Getsman
On May 21, 11:15 am, Paul McGuire <[EMAIL PROTECTED]> wrote: > > > for cur_rec in Lastdump.readline(): > > is the problem. readline() returns a string containing the next > line's worth of text, NOT an iterator over all the subsequent lines in > the file. So your code is really saying: > >

Re: [ctypes] convert pointer to string?

2008-05-21 Thread Neal Becker
[EMAIL PROTECTED] wrote: > Neal Becker napisał(a): >> In an earlier post, I was interested in passing a pointer to a structure >> to fcntl.ioctl. >> >> This works: >> >> c = create_string_buffer (...) >> args = struct.pack("iP", len(c), cast (pointer (c), c_void_p).value) >> err = fcntl.ioctl(eos_

Re: can someone with guessing a number

2008-05-21 Thread abhilash pp
if tries > 10: print 'you failed- give up' On Wed, May 21, 2008 at 10:12 PM, garywood <[EMAIL PROTECTED]> wrote: > I would just like the program to exit after guessing the amount of > numbers wrong > > # Guess My Number > import random > the_number = random.randrange(100) + 1 > trie

Re: can someone with guessing a number

2008-05-21 Thread abhilash pp
if tries > 10: print 'you failed- give up' break <--- use this On Wed, May 21, 2008 at 10:24 PM, abhilash pp <[EMAIL PROTECTED]<[EMAIL PROTECTED]>> wrote: > > > if tries > 10: > print 'you failed- give up' > > > On Wed, May 21, 2008 at 10:12 PM, gar

Re: can someone with guessing a number

2008-05-21 Thread Dan Upton
On Wed, May 21, 2008 at 12:42 PM, garywood <[EMAIL PROTECTED]> wrote: > I would just like the program to exit after guessing the amount of numbers > wrong > > # Guess My Number > import random > the_number = random.randrange(100) + 1 > tries = 1 > # guessing loop > while (guess != the_number): >

Re: C-like assignment expression?

2008-05-21 Thread inhahe
>> >> One thing I hate from C is the assignment in expressions...Forcing >> myself to write >> 0 == Something >> rather than >> Something == 0 > > interesting trick, i've never thought of that/seen it > although if Python implemented it I think it should default to giving > warnings when you use =

Re: Python and Flaming Thunder

2008-05-21 Thread Torsten Bronger
Hallöchen! Daniel Fetchinson writes: 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 "in

Re: can someone with guessing a number

2008-05-21 Thread Dan Upton
On Wed, May 21, 2008 at 12:55 PM, abhilash pp <[EMAIL PROTECTED]> wrote: >> On Wed, May 21, 2008 at 10:12 PM, garywood <[EMAIL PROTECTED]> wrote: >>> >>> I would just like the program to exit after guessing the amount of >>> numbers wrong >>> >>> # Guess My Number >>> import random >>> the_number =

Re: Misuse of list comprehensions?

2008-05-21 Thread Simon Forman
On May 21, 4:36 am, Bruno Desthuilliers wrote: > Simon Forman a écrit : > > > > > On May 20, 8:58 am, Paul McGuire <[EMAIL PROTECTED]> wrote: > >> On May 20, 10:50 am, [EMAIL PROTECTED] wrote: > > >>> You don't need all those conditionals. A set differs from a list > >>> precisely in the fact that

Re:

2008-05-21 Thread D'Arcy J.M. Cain
On Wed, 21 May 2008 09:21:05 -0700 (PDT) ahmed khattab <[EMAIL PROTECTED]> wrote: > unsubscribe me form python list plz Please use the admin interface that you used when you subscribed: http://mail.python.org/mailman/listinfo/python-list -- D'Arcy J.M. Cain PyGreSQL Development Group http://ww

Re: Unsubscribe request

2008-05-21 Thread D'Arcy J.M. Cain
On Wed, 21 May 2008 13:19:11 -0400 "D'Arcy J.M. Cain" <[EMAIL PROTECTED]> wrote: > On Wed, 21 May 2008 09:21:05 -0700 (PDT) > ahmed khattab <[EMAIL PROTECTED]> wrote: > > unsubscribe me form python list plz > > Please use the admin interface that you used when you subscribed: > > http://mail.pyth

Python/ZCA Healthcare Project Announcement

2008-05-21 Thread Tim Cook
Hi All, I apologize for the length of and the cross posting of this announcement in advance but I believe it will be of value to you if you have ANY interest in the healthcare IT field. Even if you do not have interest now; you may well after you realize the staggering growth that is occurring in

Re: C-like assignment expression?

2008-05-21 Thread MRAB
On May 21, 5:50 pm, "inhahe" <[EMAIL PROTECTED]> wrote: > >> One thing I hate from C is the assignment in expressions...Forcing > >> myself to write > >> 0 == Something > >> rather than > >> Something == 0 > > > interesting trick, i've never thought of that/seen it > > although if Python implemente

extracting title and/or summary of a website

2008-05-21 Thread ravinder thakur
hello friends, 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 ? thanks ravinder thakur -- http://mail.python.org/mailman/listinfo/python-list

Re: Using Python for programming algorithms

2008-05-21 Thread sturlamolden
On May 21, 12:01 pm, Bruno Desthuilliers wrote: > > C has proven very difficult to optimize, particularly because pointer > > aliasing prevents efficient register allocation. > > Does this compare to optimizing something like Python ? (serious > question, but I think I already know part of the an

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

2008-05-21 Thread Ethan Furman
John Machin wrote: Robert Kern wrote: Ethan Furman wrote: Greetings, I'm looking at the struct module for binary packing of ints and floats. The documentation refers to C datatypes. It's been many years since I looked at C, but I seem to remember that the data type sizes were not fixed

Re: Newbie: Keep TCP socket open

2008-05-21 Thread Roy Smith
In article <[EMAIL PROTECTED]>, "Alan Wright" <[EMAIL PROTECTED]> wrote: > infact there is no need for any IT phone calls, I am the owner of this > network That's the best way to do it :-) -- http://mail.python.org/mailman/listinfo/python-list

Re: Database Query Contains Old Data

2008-05-21 Thread giraffeboy
On May 21, 3:23 pm, Paul Boddie <[EMAIL PROTECTED]> wrote: > Note that if you have a connection open in your program, especially if > that connection has already been used to select data, it may be the > case that you then have to perform a rollback or commit before > attempting to access newly ad

What replaces `` in py3k?

2008-05-21 Thread bukzor
In Python 3, backticks (``) are being removed. The plan is to create an automatic way to port python2 programs to python3, so my question is: What are backticks going to be translated into? I tried looking at the 2to3 fixer source code, but as far as I can tell they haven't written that part yet.

Re: What replaces `` in py3k?

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

Re: Using Python for programming algorithms

2008-05-21 Thread sturlamolden
On May 21, 11:59 am, Bruno Desthuilliers wrote: > Strange enough, no one calls Java or C# 'interpreted languages', while > they (or, to be more exact, their reference implementations) both use > the same byte-code/VM scheme[1]. Java interprets the bytecode in a virtual machine by default. Only

Re: C-like assignment expression?

2008-05-21 Thread sturlamolden
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 illegal in python. Assignment expressions is disallowed in Python to prote

Re: conventions/requirements for 'is' vs '==', 'not vs '!=', etc

2008-05-21 Thread Lie
On May 20, 10:42 am, John Salerno <[EMAIL PROTECTED]> wrote: > On Mon, 19 May 2008 20:34:22 -0700 (PDT) > > [EMAIL PROTECTED] wrote: > > i am confused. > > > x=5 > > y=5 > > > x==y -> True > > x is y -> True > > > shouldnt x is y return False since they shouldnt(dont?) point to the > > same place i

Re: conventions/requirements for 'is' vs '==', 'not vs '!=', etc

2008-05-21 Thread Lie
On May 20, 2:39 am, destroy <[EMAIL PROTECTED]> wrote: > I'm wondering what is the canonical usage of the keywords 'is' and > 'not' when you're writing conditionals and loops. The one I've been > following is completely arbitrary--I use the symbols '==', '!=' for > numerical comparisons and the

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

2008-05-21 Thread Mark Dickinson
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", "credits" or "license" for more information. >>> a = 1e16-2.

Re: Help on thread pool

2008-05-21 Thread Aahz
In article <[EMAIL PROTECTED]>, Alex <[EMAIL PROTECTED]> wrote: > >In order to understand the concept of threading pool in python I'm >working on a simple single-site web crawler. You can also compare your code against http://www.pythoncraft.com/OSCON2001/ThreadPoolSpider.py -- Aahz ([EMAIL PR

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

2008-05-21 Thread Diez B. Roggisch
Mark Dickinson schrieb: 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", "credits" or "license" for more inf

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

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: 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"

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: 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: 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

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: 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

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: 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: 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: 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: 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: 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: 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

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: 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

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: 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 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: 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: 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 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 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 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: 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 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: 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 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 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: 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: 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: 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: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: 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: 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 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: 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: 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: 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: 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.

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: 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

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: 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: 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 > >>

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: 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

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 > >>

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

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

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

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 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: 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: 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: 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: 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: 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: 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

<    1   2   3   >