Re: Bug in email.utils, parseaddr

2008-05-08 Thread Gabriel Genellina
En Fri, 09 May 2008 02:55:46 -0300, Roopesh <[EMAIL PROTECTED]> escribió: I tried using parseaddr of email.utils, but it gave the following result when the name had a comma inside. e = 'K,Vishal <[EMAIL PROTECTED]>' from email.utils import parseaddr parseaddr(e) ('', 'K') That's an invali

Re: The Importance of Terminology's Quality

2008-05-08 Thread Waylen Gumbal
Jürgen Exner wrote: > "Waylen Gumbal" <[EMAIL PROTECTED]> wrote: > > Sherman Pendley wrote: > > > [EMAIL PROTECTED] writes: > > > > > > > > > PLEASE DO NOT | :.:\:\:/:/:.: > > > > > FEED THE TROLLS | :=.' - - '.=: > > Not everyone follows language-neutral groups (such as > > comp,programming as yo

Re: The Importance of Terminology's Quality

2008-05-08 Thread Waylen Gumbal
Lew wrote: > Waylen Gumbal wrote: >> Not everyone follows language-neutral groups (such as >> comp,programming as you pointed out), so you actually reach more >> people by cross posting. This is what I don't understand - everyone >> seems to assume that by cross posting, one intends on start a >> "

Re: how to use subprocess.Popen execute "find" in windows

2008-05-08 Thread clyfish
On 5月8日, 下午5时39分, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Wed, 07 May 2008 23:29:58 -0300, <[EMAIL PROTECTED]> escribió: > > > > > On 5月7日, 上午9时45分, Justin Ezequiel <[EMAIL PROTECTED]> > > wrote: > >> On May 6, 5:19 pm, [EMAIL PROTECTED] wrote: > > >> > p1 = Popen(['netstat', '-an'], st

Re: Python script freezed on Window DOS terminal

2008-05-08 Thread Gabriel Genellina
En Fri, 09 May 2008 01:42:21 -0300, hce <[EMAIL PROTECTED]> escribió: I am running Python and a script on XP DOS terminal, the script build.py printed out messages on the Terminal, then asked for an input of numbers. But, I pressed a key, nothing came in DOS terminal, Eventually, no key active a

Re: Mathematics in Python are not correct

2008-05-08 Thread Arnaud Delobelle
Dan Bishop <[EMAIL PROTECTED]> writes: > On May 8, 6:14 pm, Luis Zarrabeitia <[EMAIL PROTECTED]> wrote: >> On Thursday 08 May 2008 06:54:42 pm [EMAIL PROTECTED] wrote: >> >> > The problem is that Python parses -123**0 as -(123**0), not as >> > (-123)**0. >> >> Actually, I've always written it as (

Re: slicing lists

2008-05-08 Thread Ian Kelly
On Wed, May 7, 2008 at 5:29 PM, Yves Dorfsman <[EMAIL PROTECTED]> wrote: > Is there a way to do: > x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] > x[0,2:6] > > That would return: > [0, 3, 4, 5, 6] > > I am surprised this notation is not supported, it seems intuitive. > A concrete example of the sort of thing

Re: python newbie: some surprises

2008-05-08 Thread Gabriel Genellina
En Fri, 09 May 2008 01:47:49 -0300, Yves Dorfsman <[EMAIL PROTECTED]> escribió: I see the point of the OP. Couldn't the new-line be used as an equivalent of ':', for example, do you find this difficult to read: if a == 3 do_something() if a == 3: do_something() And surely, it shoul

Re: Python Math libraries - How to?

2008-05-08 Thread Gabriel Genellina
En Thu, 08 May 2008 13:17:51 -0300, delta2 <[EMAIL PROTECTED]> escribió: I am also using Zelle's book to teach myself programming and Python. I also had a problem with " import math ", but the alternative of " from math import * " is working for me. I don't know why one works and the othe

Re: anagram finder / dict mapping question

2008-05-08 Thread Arnaud Delobelle
"Kam-Hung Soh" <[EMAIL PROTECTED]> writes: > I avoid creating a temporary variable if it's only used once > immediately, so I would have written: > > newtlist = ''.join(sorted(list(line))) Or ''.join(sorted(line)) as sorted() works with any iterable. -- Arnaud -- http://mail.python.org/mailma

Bug in email.utils, parseaddr

2008-05-08 Thread Roopesh
Hi, I tried using parseaddr of email.utils, but it gave the following result when the name had a comma inside. >>> e = 'K,Vishal <[EMAIL PROTECTED]>' >>> from email.utils import parseaddr >>> parseaddr(e) ('', 'K') Thanks and Regards, Roopesh -- http://mail.python.org/mailman/listinfo/python-lis

Re: Custom Classes?

2008-05-08 Thread Gabriel Genellina
En Thu, 08 May 2008 12:33:55 -0300, Victor Subervi <[EMAIL PROTECTED]> escribió: Okay, trying this again with everything working and no ValueError or any other errors, here we go: getpic = "getpic" + str(w) + ".py" Why do you *generate* the getpicNN.py? It contains always the same code,

Re: Surprising difference in behavior between "import blah" and "from blah import thing"

2008-05-08 Thread Arnaud Delobelle
Eric Hanchrow <[EMAIL PROTECTED]> writes: > (This is with Python 2.5.2, on Ubuntu Hardy, if it matters.) > > This seems so basic that I'm surprised that I didn't find anything > about it in the FAQ. (Yes, I am fairly new to Python.) > > Here are three tiny files: > > mut.py > > impo

Re: The Importance of Terminology's Quality

2008-05-08 Thread J�rgen Exner
"Waylen Gumbal" <[EMAIL PROTECTED]> wrote: >Sherman Pendley wrote: >> [EMAIL PROTECTED] writes: >> > >> > > PLEASE DO NOT | :.:\:\:/:/:.: >> > > FEED THE TROLLS | :=.' - - '.=: >Not everyone follows language-neutral groups (such as comp,programming >as you pointed out), so you actually reach more

Re: The Importance of Terminology's Quality

2008-05-08 Thread Lew
Waylen Gumbal wrote: Not everyone follows language-neutral groups (such as comp,programming as you pointed out), so you actually reach more people by cross posting. This is what I don't understand - everyone seems to assume that by cross posting, one intends on start a "flamefest", when in fact

Re: Weird bug with an integer

2008-05-08 Thread Gabriel Genellina
En Thu, 08 May 2008 22:47:59 -0300, David Anderson <[EMAIL PROTECTED]> escribió: Ps: When I go to shell and type:rowN = int(0) Why int(0)? Why not just 0??? Look this slice of code: rowN = int(0) for row in rows: success = self.resultGrid.AppendRows(); colN

Re: threading - race condition?

2008-05-08 Thread Gabriel Genellina
En Fri, 09 May 2008 01:30:32 -0300, skunkwerk <[EMAIL PROTECTED]> escribió: On May 8, 4:54 pm, [EMAIL PROTECTED] wrote: On May 8, 5:45 pm, skunkwerk <[EMAIL PROTECTED]> wrote: > i'm getting the wrong output for the 'title' attributes for this > data. the queue holds a data structure (item

Re: The Importance of Terminology's Quality

2008-05-08 Thread Waylen Gumbal
Sherman Pendley wrote: > [EMAIL PROTECTED] writes: > > > > > PLEASE DO NOT | :.:\:\:/:/:.: > > > FEED THE TROLLS | :=.' - - '.=: > > > > I don't think Xah is trolling here (contrary to his/her habit) > > but posing an interesting matter of discussion. > > It might be interesting in the abstract, bu

Re: Cannot import opj

2008-05-08 Thread Gabriel Genellina
En Thu, 08 May 2008 21:28:25 -0300, David Anderson <[EMAIL PROTECTED]> escribió: I'm trying to import the opj module What's the opj module? Trying like this: from Main import opj It says it doesn't exists And why do you think it should exist? And like this: import os.path.join as opj R

Re: slicing lists

2008-05-08 Thread Yves Dorfsman
MRAB wrote: You should've read the thread entitled "Why don't generators execute until first yield?"! :-) Michael Torrie gave the URL http://www.dabeaz.com/generators/Generators.pdf. Your example can be rewritten as follows: p = file('/etc/passwd') # No need for readlines() because file's itera

Re: explain this function to me, lambda confusion

2008-05-08 Thread Gabriel Genellina
En Thu, 08 May 2008 22:57:03 -0300, <[EMAIL PROTECTED]> escribió: On May 8, 6:11 pm, Duncan Booth <[EMAIL PROTECTED]> wrote: No, no, no, no, no! Geez. Go easy. You have got it entirely wrong here. Your XOR function simply [...] Pardon my tetchiness, but it is a little hard to receive su

Re: Mathematics in Python are not correct

2008-05-08 Thread Luis Zarrabeitia
Quoting Ian Kelly <[EMAIL PROTECTED]>: > On Thu, May 8, 2008 at 10:15 PM, Luis Zarrabeitia <[EMAIL PROTECTED]> wrote: > > Weird, I can't find neither... (which wikipedia article? Couldn't find one > about > > C99.) > > Try http://en.wikipedia.org/wiki/Exponentiation#Zero_to_the_zero_power Than

Re: python newbie: some surprises

2008-05-08 Thread Mensanator
On May 8, 11:47�pm, Yves Dorfsman <[EMAIL PROTECTED]> wrote: > Mensanator wrote: > >> 2. python requires to pass "self" to all instance methods > > > Who uses methods? > > Is this a joke ? Yes. > What are the alternatives ? > > > > >> and I missed ":" often. :) > > > Try using something like Seed

Re: Mathematics in Python are not correct

2008-05-08 Thread Mensanator
On May 8, 11:28�pm, "Ian Kelly" <[EMAIL PROTECTED]> wrote: > On Thu, May 8, 2008 at 10:15 PM, Luis Zarrabeitia <[EMAIL PROTECTED]> wrote: > > �Weird, I can't find neither... (which wikipedia article? Couldn't find one > > about > > �C99.) > > Tryhttp://en.wikipedia.org/wiki/Exponentiation#Zero_to_

Re: python newbie: some surprises

2008-05-08 Thread Yves Dorfsman
Mensanator wrote: 2. python requires to pass "self" to all instance methods Who uses methods? Is this a joke ? What are the alternatives ? and I missed ":" often. :) Try using something like Seed7, where you have to use "then" with "if" and "do" with "while" and "end" in every block. M

Which way is faster for a simple web reporting system: django, web.py or cgi

2008-05-08 Thread idev
Hi all, May be this is a dump question, but it makes me crazy in my research. I am not a developer but I have experience with web development (PHP) in a past. Most my activities are around database administration and design. For most database administration tasks I am using Python. Very often I ne

Python script freezed on Window DOS terminal

2008-05-08 Thread hce
Hi, I am running Python and a script on XP DOS terminal, the script build.py printed out messages on the Terminal, then asked for an input of numbers. But, I pressed a key, nothing came in DOS terminal, Eventually, no key active and seem the DOS terminal is freezed. I could not even terminate the

Re: threading - race condition?

2008-05-08 Thread skunkwerk
On May 8, 4:54 pm, [EMAIL PROTECTED] wrote: > On May 8, 5:45 pm, skunkwerk <[EMAIL PROTECTED]> wrote: > > > > > i'm getting the wrong output for the 'title' attributes for this > > data. the queue holds a data structure (item name, position, and list > > to store results in). each thread takes in

Re: Mathematics in Python are not correct

2008-05-08 Thread Ian Kelly
On Thu, May 8, 2008 at 10:15 PM, Luis Zarrabeitia <[EMAIL PROTECTED]> wrote: > Weird, I can't find neither... (which wikipedia article? Couldn't find one > about > C99.) Try http://en.wikipedia.org/wiki/Exponentiation#Zero_to_the_zero_power -- http://mail.python.org/mailman/listinfo/python-list

Re: Mathematics in Python are not correct

2008-05-08 Thread Luis Zarrabeitia
Quoting Christian Heimes <[EMAIL PROTECTED]>: > Luis Zarrabeitia schrieb: > 0**0 > > 1 > > > > That 0^0 should be a nan or exception, I guess, but not 1. > > No, that's correct for floats. Read the wikipedia article or the C99 > standard for more information. Weird, I can't find neither..

Re: RELEASED Python 2.6a3 and 3.0a5

2008-05-08 Thread Kay Schluehr
On 9 Mai, 01:50, Barry Warsaw <[EMAIL PROTECTED]> wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > On behalf of the Python development team and the Python community, I > am happy to announce the third alpha release of Python 2.6, and the > fifth alpha release of Python 3.0. > > Please n

Re: range with variable leading zeros

2008-05-08 Thread alex23
On May 9, 1:42 pm, yhvh <[EMAIL PROTECTED]> wrote: > I want to generate a range with variable leading zeros > > x = [0010, 0210] > padding = len(x[1]) > > for j in range(x[0], x[1]): > print (url).join('%0(pad)d(jj)'+'.jpg') %{'pad':padding, 'jj':j} > > This is syntactically incorrect, you can'

Re: range with variable leading zeros

2008-05-08 Thread Dan Bishop
On May 8, 10:42 pm, yhvh <[EMAIL PROTECTED]> wrote: > I want to generate a range with variable leading zeros > > x = [0010, 0210] You do realize that this is octal, right? > padding = len(x[1]) len is undefined for integers. Perhaps you meant "len(str(x[1]))". > for j in range(x[0], x[1]): >  

Re: pickle problem

2008-05-08 Thread Marc 'BlackJack' Rintsch
On Thu, 08 May 2008 23:35:04 +0200, Hrvoje Niksic wrote: > Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> writes: > >> On Thu, 08 May 2008 08:55:35 -0700, krustymonkey wrote: >> >>> The thing is, I'm not using slots by choice. I'm using the standard >>> lib "socket" class, which apparently uses sl

Re: Free Memory

2008-05-08 Thread Ian Kelly
On Thu, May 8, 2008 at 6:30 PM, Dark Wind <[EMAIL PROTECTED]> wrote: > Hi, > > How can I free all the memory in python by deleting all variables. I am > looking for the equivalent of 'clear' from Matlab. > > I know del x deletes a variable x, but it doesn't free all the available > memory. I don't

range with variable leading zeros

2008-05-08 Thread yhvh
I want to generate a range with variable leading zeros x = [0010, 0210] padding = len(x[1]) for j in range(x[0], x[1]): print (url).join('%0(pad)d(jj)'+'.jpg') %{'pad':padding, 'jj':j} This is syntactically incorrect, you can't insert a variable into the string format options. Any ideas? -

Re: How can I add spaces where ever I have capital letters?

2008-05-08 Thread John Schroeder
I do like one-liners and do not like regexps! That code puts mine to shame... Thanks for the tip. I'll use that one instead. On Thu, May 8, 2008 at 7:40 PM, Dan Bishop <[EMAIL PROTECTED]> wrote: > > On Thu, May 8, 2008 at 9:12 PM, John Schroeder <[EMAIL PROTECTED]> > wrote: > > > I have a stri

Re: How can I add spaces where ever I have capital letters?

2008-05-08 Thread Dan Bishop
> On Thu, May 8, 2008 at 9:12 PM, John Schroeder <[EMAIL PROTECTED]> wrote: > > I have a string (which I got from the names of my classes) and I would like > > to print out my CamelCase classes as titles. > > > I would like it to do this: > > my_class_name = "ModeCommand" > > ## Do some magic

Re: How can I add spaces where ever I have capital letters?

2008-05-08 Thread John Schroeder
Thanks guys. That upper() function reminded me to use the isupper() function. I got this going in a single pass: def a(name): self_name = name # Increment this value every time we add a space offset = 0 for i in xrange(len(name)): if i != 0 and name[i].isupper():

Re: Mathematics in Python are not correct

2008-05-08 Thread Dan Bishop
On May 8, 6:14 pm, Luis Zarrabeitia <[EMAIL PROTECTED]> wrote: > On Thursday 08 May 2008 06:54:42 pm [EMAIL PROTECTED] wrote: > > > The problem is that Python parses -123**0 as -(123**0), not as > > (-123)**0. > > Actually, I've always written it as (-123)**0. At least where I'm from, > exponentiat

Re: anagram finder / dict mapping question

2008-05-08 Thread Jerry Hill
On Thu, May 8, 2008 at 7:52 PM, dave <[EMAIL PROTECTED]> wrote: > I got it! Thanks for all your help!!! Please tell me what you think: Here's yet another version of the same thing, using defaultdicts and sets. This way we don't have to test for membership in either the dictionary or the co

Re: anagram finder / dict mapping question

2008-05-08 Thread Kam-Hung Soh
On Fri, 09 May 2008 09:52:53 +1000, dave <[EMAIL PROTECTED]> wrote: I got it! Thanks for all your help!!! Please tell me what you think: def anafind(): fin = open('short.txt') #one word per line mapdic = {} #this di

ASCII character logger program in Python? (Or how to modify EVDEV.py)

2008-05-08 Thread Dr. Colombes
I've used a very nice Keystroke Logger Python shareware program (EVDEV.py), written by Micah Dowty. But I couldn't find a dedicated ASCII Character Logger program. Does anyone know of an ASCII Character Logger program (preferably Python)? Or how to modify EVDEV.py to log ASCII characte

Re: How can I add spaces where ever I have capital letters?

2008-05-08 Thread Eric Wertman
Something like this. I'm sure there are other ways to do it. import re def addspace(m) : return ' ' + m.group(0) strng = "ModeCommand" newstr = re.sub('[A-Z]',addspace,strng) print newstr.strip() On Thu, May 8, 2008 at 9:12 PM, John Schroeder <[EMAIL PROTECTED]> wrote: > I have a

Re: explain this function to me, lambda confusion

2008-05-08 Thread andrej . panjkov
On May 8, 6:11 pm, Duncan Booth <[EMAIL PROTECTED]> wrote: > > No, no, no, no, no! > Geez. Go easy. > You have got it entirely wrong here. Your XOR function simply returns a > function which gives you the result of xoring the parameters AT THE TIME > WHEN YOU ORIGINALLY CREATED IT. I'm guessing

Re: Weird bug with an integer

2008-05-08 Thread David Anderson
Ps: When I go to shell and type:rowN = int(0) rows = [["1223", "11/23/08", "Purchase", "To be shipped", "Gallery Name", "Art Title[22 of 300]", "$10,000"],#1st row ["1223", "11/23/08", "Purchase", "To be shipped", "Gallery Name", "Art Title[22 of 300]", "$10,000"],#2nd row

Weird bug with an integer

2008-05-08 Thread David Anderson
Look this slice of code: rowN = int(0) for row in rows: success = self.resultGrid.AppendRows(); colN = int(0) for col in row: self.resultGrid.SetReadOnly(self.resultGrid.GetNumberRows() - 1,colN,isReadOnly = True) print ro

Re: Using Python to verify streaming tv/radio station links

2008-05-08 Thread donnyf
On Apr 29, 10:11 am, [EMAIL PROTECTED] wrote: > Hey! > > With regards checking feeds, look into urllib (maybe) and the httplib > (definitely). They /could/ offer some sort of information regarding > the activity of your feeds. Without knowing anything about the > streaming protocols I wouldn't sugg

Re: The Importance of Terminology's Quality

2008-05-08 Thread George Neuner
On Thu, 08 May 2008 03:25:54 -0700, [EMAIL PROTECTED] (Robert Maas, http://tinyurl.com/uh3t) wrote: >> From: "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> >> the importance of naming of functions. > >> ... [take] a keyword and ask a wide >> audience, who doesn't know about the language or even unfamilia

Re: Mathematics in Python are not correct

2008-05-08 Thread Erik Max Francis
[EMAIL PROTECTED] wrote: Have a look at this: -123**0 -1 The result is not correct, because every number (positive or negative) raised to the power of 0 is ALWAYS 1 (a positive number 1 that is). The problem is that Python parses -123**0 as -(123**0), not as (-123)**0. I suggest making th

How can I add spaces where ever I have capital letters?

2008-05-08 Thread John Schroeder
I have a string (which I got from the names of my classes) and I would like to print out my CamelCase classes as titles. I would like it to do this: >>> my_class_name = "ModeCommand" ## Do some magic here >>> my_class_name 'Mode Command' Anyone know any easy way to do this? Thanks. -- http://ma

Re: The Importance of Terminology's Quality

2008-05-08 Thread Jon Harrop
Terry Reedy wrote: > "Jon Harrop" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > | Perhaps the best example I can think of to substantiate your original > point > | is simple comparison because Mathematica allows: > | > | a < b < c > | > | I wish other languages did. > > Python d

Re: Mathematics in Python are not correct

2008-05-08 Thread Terry Reedy
"Luis Zarrabeitia" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | Btw, there seems to be a math problem in python with exponentiation... | >>> 0**0 | 1 | That 0^0 should be a nan or exception, I guess, but not 1. a**b is 1 multiplied by a, b times. 1 multiplied by 0 no times is 1

Re: The Importance of Terminology's Quality

2008-05-08 Thread Terry Reedy
"Jon Harrop" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | Perhaps the best example I can think of to substantiate your original point | is simple comparison because Mathematica allows: | | a < b < c | | I wish other languages did. Python does also. -- http://mail.python.or

Free Memory

2008-05-08 Thread Dark Wind
Hi, How can I free all the memory in python by deleting all variables. I am looking for the equivalent of 'clear' from Matlab. I know del x deletes a variable x, but it doesn't free all the available memory. Thank you -- http://mail.python.org/mailman/listinfo/python-list

Re: pickle problem

2008-05-08 Thread castironpi
On May 8, 4:35 pm, Hrvoje Niksic <[EMAIL PROTECTED]> wrote: > Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> writes: > > > On Thu, 08 May 2008 08:55:35 -0700, krustymonkey wrote: > > >> The thing is, I'm not using slots by choice.  I'm using the standard > >> lib "socket" class, which apparently uses

Cannot import opj

2008-05-08 Thread David Anderson
I'm trying to import the opj module Trying like this: from Main import opj It says it doesn't exists And like this: import os.path.join as opj Raises error. What should I do? -- http://mail.python.org/mailman/listinfo/python-list

Re: observer pattern question #1 (reference to subject)

2008-05-08 Thread castironpi
On May 8, 4:57 pm, Alan Isaac <[EMAIL PROTECTED]> wrote: > Ville M. Vainio wrote: > > in case of stocks, you are probably monitoring several > > stock objects, so the stock should probably pass itself to > > the observer > > OK.  This is related to my question #2 (in a separate > > thread), where I

Re: Python Syntax and misspelled variable and method name checker?

2008-05-08 Thread castironpi
On May 8, 1:06 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > neerashish schrieb: > > > > > Is there a good Python Syntax and mis-spelled variable and method name > > checker available. > > > I have been programming in python for last 6 months and misspelled variables > > and method names have

Re: Running a python code periodically

2008-05-08 Thread castironpi
On May 8, 3:31 pm, "Terry Reedy" <[EMAIL PROTECTED]> wrote: > "Maryam Saeedi" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > |I was wondering if you know how can I run a python code once every five > | minutes for a period of time either using python or some other program > like

Re: Python GUIs and custom controls

2008-05-08 Thread castironpi
On May 8, 4:30 pm, "Chuckk Hubbard" <[EMAIL PROTECTED]> wrote: > I likewise don't know enough to compare between toolkits, but another > one to check out might be pygame.  If nothing else, it is meant to be > fast and to handle 3D views. > > -Chuckk > > On Fri, May 9, 2008 at 12:10 AM, Joe P. Cool

Re: Mathematics in Python are not correct

2008-05-08 Thread Christian Heimes
Luis Zarrabeitia schrieb: 0**0 > 1 > > That 0^0 should be a nan or exception, I guess, but not 1. No, that's correct for floats. Read the wikipedia article or the C99 standard for more information. Christian -- http://mail.python.org/mailman/listinfo/python-list

Re: anagram finder / dict mapping question

2008-05-08 Thread Paul Rubin
dave <[EMAIL PROTECTED]> writes: > if newtlist not in mapdic: > mapdic[newtlist] = [line] > if line not in mapdic[newtlist]: > mapdic[newtlist].append(line) I'd use the defaultdi

Re: RELEASED Python 2.6a3 and 3.0a5

2008-05-08 Thread castironpi
On May 8, 6:50 pm, Barry Warsaw <[EMAIL PROTECTED]> wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > On behalf of the Python development team and the Python community, I   > am happy to announce the third alpha release of Python 2.6, and the   > fifth alpha release of Python 3.0. > > Pl

Re: threading - race condition?

2008-05-08 Thread castironpi
On May 8, 5:45 pm, skunkwerk <[EMAIL PROTECTED]> wrote: > i'm getting the wrong output for the 'title' attributes for this > data.  the queue holds a data structure (item name, position, and list > to store results in).  each thread takes in an item name and queries a > database for various attribu

Re: anagram finder / dict mapping question

2008-05-08 Thread dave
On 2008-05-07 19:25:53 -0600, "Kam-Hung Soh" <[EMAIL PROTECTED]> said: On Thu, 08 May 2008 11:02:12 +1000, dave <[EMAIL PROTECTED] t> wrote: Hi All, I wrote a program that takes a string sequence and finds all the wo rds inside a text file (one word per line) and prints them: def an

RELEASED Python 2.6a3 and 3.0a5

2008-05-08 Thread Barry Warsaw
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On behalf of the Python development team and the Python community, I am happy to announce the third alpha release of Python 2.6, and the fifth alpha release of Python 3.0. Please note that these are alpha releases, and as such are not suitable

Re: Mathematics in Python are not correct

2008-05-08 Thread castironpi
On May 8, 6:10 pm, Nicolas Dandrimont <[EMAIL PROTECTED]> wrote: > * [EMAIL PROTECTED] <[EMAIL PROTECTED]> [2008-05-08 15:54:42 -0700]: > > > Have a look at this: > > > >>> -123**0 > > -1 > > > The result is not correct, because every number (positive or negative) > > raised to the power of 0 is AL

Re: Write a python blog/website?

2008-05-08 Thread Sumon Sadhu
Hey Dotan, My apologies if this post caused offense. Your assertion is right, maybe i should have emailed everyone individually like i've done with the first 45 sites, but it was never my intention to spam. We're programmers like yourself, trying to build something that provides a lot of

Re: Mathematics in Python are not correct

2008-05-08 Thread Nicolas Dandrimont
* [EMAIL PROTECTED] <[EMAIL PROTECTED]> [2008-05-08 15:54:42 -0700]: > Have a look at this: > > >>> -123**0 > -1 > > > The result is not correct, because every number (positive or negative) > raised to the power of 0 is ALWAYS 1 (a positive number 1 that is). > > The problem is that Python par

Re: Mathematics in Python are not correct

2008-05-08 Thread Ben Finney
[EMAIL PROTECTED] writes: > The problem is that Python parses -123**0 as -(123**0), not as > (-123)**0. As explicitly defined in the language reference, the "negative" operator has lower binding precedence than the "power" operator http://www.python.org/doc/ref/summary.html>. > I suggest making

Re: Mathematics in Python are not correct

2008-05-08 Thread Luis Zarrabeitia
On Thursday 08 May 2008 06:54:42 pm [EMAIL PROTECTED] wrote: > The problem is that Python parses -123**0 as -(123**0), not as > (-123)**0. Actually, I've always written it as (-123)**0. At least where I'm from, exponentiation takes precedence even over unary "-". (to get a power of -123, you mus

Re: Mathematics in Python are not correct

2008-05-08 Thread Michael Torrie
Ahem... That should have been: (negate (pow 123 0)) Using parenthesis to indicate precedence order of ops: -(123 ^ 0) The "-" you are using is not part of the number. It's a unary operator that negates something. In normal order of operations, it has a much lower priority than power. Your p

Re: Mathematics in Python are not correct

2008-05-08 Thread Michael Torrie
[EMAIL PROTECTED] wrote: > Have a look at this: > -123**0 > -1 > > > The result is not correct, because every number (positive or negative) > raised to the power of 0 is ALWAYS 1 (a positive number 1 that is). No python is correct. you're expression parses this way, when converted to a li

Re: Write a python blog/website?

2008-05-08 Thread Dotan Cohen
2008/5/8 sharpshoot <[EMAIL PROTECTED]>: > Hi Guys, > > I thought this would be really interesting to people who blog who > might be able to help us. Your proposal very well may be interesting to those who might be able to help you, yet, you dug your own grave by spamming the Python list. I see th

Mathematics in Python are not correct

2008-05-08 Thread wxPythoner
Have a look at this: >>> -123**0 -1 The result is not correct, because every number (positive or negative) raised to the power of 0 is ALWAYS 1 (a positive number 1 that is). The problem is that Python parses -123**0 as -(123**0), not as (-123)**0. I suggest making the Python parser omit the n

threading - race condition?

2008-05-08 Thread skunkwerk
i'm getting the wrong output for the 'title' attributes for this data. the queue holds a data structure (item name, position, and list to store results in). each thread takes in an item name and queries a database for various attributes. from the debug statements the item names are being retriev

Re: Surprising difference in behavior between "import blah" and "from blah import thing"

2008-05-08 Thread Ben Finney
offby1 <[EMAIL PROTECTED]> writes: > Ah. So from the point of view of mut.py, "thing" and "system.thing" > are separate, unrelated variables; No. Thinking of them as "variables" (with all the non-Python terminological baggage that implies) will only exacerbate the confusion. "thing" and "system

Re: python vs. grep

2008-05-08 Thread Ricardo Aráoz
Anton Slesarev wrote: I try to save my time not cpu cycles) I've got file which I really need to parse: -rw-rw-r-- 1 xxx xxx 3381564736 May 7 09:29 bigfile That's my results: $ time grep "python" bigfile | wc -l 2470 real0m4.744s user0m2.441s sys 0m2.307s And python scrip

Re: "prove"

2008-05-08 Thread hdante
On May 8, 10:50 am, "Lucas Prado Melo" <[EMAIL PROTECTED]> wrote: > Hello, > How could I "prove" to someone that python accepts this syntax using > the documentation (I couldn't find it anywhere): > classname.functionname(objectname) It's in the language reference, section 3.2 "The standard type

Re: python vs. grep

2008-05-08 Thread Robert Kern
Alan Isaac wrote: Anton Slesarev wrote: I've read great paper about generators: http://www.dabeaz.com/generators/index.html Author say that it's easy to write analog of common linux tools such as awk,grep etc. He say that performance could be even better. But I have some problem with writing

Re: anagram finder / dict mapping question

2008-05-08 Thread offby1
Been there, done that: http://polyglot-anagrams.googlecode.com/svn/trunk/python/ -- http://mail.python.org/mailman/listinfo/python-list

Re: The Importance of Terminology's Quality

2008-05-08 Thread Jon Harrop
[EMAIL PROTECTED] wrote: > I'd like to introduce a blog post by Stephen Wolfram, on the design > process of Mathematica. In particular, he touches on the importance of > naming of functions. > > ? Ten Thousand Hours of Design Reviews (2008 Jan 10) by Stephen > Wolfram > http://blog.wolfram.com/20

Re: python vs. grep

2008-05-08 Thread Alan Isaac
Anton Slesarev wrote: I've read great paper about generators: http://www.dabeaz.com/generators/index.html Author say that it's easy to write analog of common linux tools such as awk,grep etc. He say that performance could be even better. But I have some problem with writing performance grep an

Re: observer pattern question #1 (reference to subject)

2008-05-08 Thread Alan Isaac
Ville M. Vainio wrote: in case of stocks, you are probably monitoring several stock objects, so the stock should probably pass itself to the observer OK. This is related to my question #2 (in a separate thread), where I'd also appreciate your comments. analogous to a typical U

Re: pickle problem

2008-05-08 Thread Hrvoje Niksic
Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> writes: > On Thu, 08 May 2008 08:55:35 -0700, krustymonkey wrote: > >> The thing is, I'm not using slots by choice. I'm using the standard >> lib "socket" class, which apparently uses slots. > > `socket` objects can't be pickled. Not just because of t

Re: The Importance of Terminology's Quality

2008-05-08 Thread j.oke
[EMAIL PROTECTED] ha scritto: > [bli bla blo, blu blu bum bum bam bam bim bim bim...] don't know Y, by your arty-phycial excerptions always seem chinese me... -JO -- http://mail.python.org/mailman/listinfo/python-list

Re: Python GUIs and custom controls

2008-05-08 Thread Chuckk Hubbard
I likewise don't know enough to compare between toolkits, but another one to check out might be pygame. If nothing else, it is meant to be fast and to handle 3D views. -Chuckk On Fri, May 9, 2008 at 12:10 AM, Joe P. Cool <[EMAIL PROTECTED]> wrote: > So far I have a little experience with Tkinter

Re: Python GUIs and custom controls

2008-05-08 Thread Mike Driscoll
On May 8, 4:10 pm, "Joe P. Cool" <[EMAIL PROTECTED]> wrote: > So far I have a little experience with Tkinter and wxPython. I wonder > which of the numerous Python GUI kits would be the best choice for a > multi platform application that makes heavy use of custom controls, 3D > views and the like? T

Re: Surprising difference in behavior between "import blah" and "from blah import thing"

2008-05-08 Thread Chuckk Hubbard
:'( I'm confused On Fri, May 9, 2008 at 12:03 AM, offby1 <[EMAIL PROTECTED]> wrote: > Ah. So from the point of view of mut.py, "thing" and "system.thing" > are separate, unrelated variables; the former of which is initialized > from the latter when mut says "from system import thing". Thanks. >

Python GUIs and custom controls

2008-05-08 Thread Joe P. Cool
So far I have a little experience with Tkinter and wxPython. I wonder which of the numerous Python GUI kits would be the best choice for a multi platform application that makes heavy use of custom controls, 3D views and the like? Thanks in advance for your hints and advice. Joe -- http://mail.pyth

Re: Feature suggestion: sum() ought to use a compensated summationalgorithm

2008-05-08 Thread Terry Reedy
"Szabolcs Horvát" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | Gabriel Genellina wrote: | > | > Python doesn't require __add__ to be associative, so this should not be used as a general sum replacement. | | It does not _require_ this, but using an __add__ that is not commutative

Re: Surprising difference in behavior between "import blah" and "from blah import thing"

2008-05-08 Thread offby1
Ah. So from the point of view of mut.py, "thing" and "system.thing" are separate, unrelated variables; the former of which is initialized from the latter when mut says "from system import thing". Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: anagram finder / dict mapping question

2008-05-08 Thread Terry Reedy
"Kam-Hung Soh" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | On Thu, 08 May 2008 15:42:07 +1000, dave <[EMAIL PROTECTED]> | wrote: | Your code is always going to return the same list because every word is an | anagram of itself. | | Tip: Create a list for each dictionary key, the

Re: pickle problem

2008-05-08 Thread Marc 'BlackJack' Rintsch
On Thu, 08 May 2008 08:55:35 -0700, krustymonkey wrote: > The thing is, I'm not using slots by choice. I'm using the standard > lib "socket" class, which apparently uses slots. `socket` objects can't be pickled. Not just because of the `__slot__`\s but because a substantial part of their state

Re: observer pattern question #1 (reference to subject)

2008-05-08 Thread Ville M. Vainio
Alan Isaac <[EMAIL PROTECTED]> writes: > the following: "OK, here's the pattern, now your listener > wants to know the event source, do not ask something new the > subject to respond to that need. That is unnecessary > coupling. Instead, just rewrite your listener to maintain > a reference to th

Re: comparing dictionaries

2008-05-08 Thread Terry Reedy
"Miki" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Hello, > I want to compare two dicts that should have identical info just in a > different data structure. The first dict's contents look like this. It > is authoritative... I know for sure it has the correct key value pairs: > >

Re: Running a python code periodically

2008-05-08 Thread Amitabh Saikia
Cron is best for this, and you should be able to create a crontab for yourself. If your system admin has not enabled user level crons. Then write a shell-script or python Shell version - count=0 max_number_of_times while [ $count < $max_number_of_times ]; do your_command & slee

Re: Surprising difference in behavior between "import blah" and "from blah import thing"

2008-05-08 Thread J. Cliff Dyer
On Thu, 2008-05-08 at 12:00 -0700, Eric Hanchrow wrote: > (This is with Python 2.5.2, on Ubuntu Hardy, if it matters.) > > This seems so basic that I'm surprised that I didn't find anything > about it in the FAQ. (Yes, I am fairly new to Python.) > > Here are three tiny files: > > mut.py =

Re: Running a python code periodically

2008-05-08 Thread Terry Reedy
"Maryam Saeedi" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] |I was wondering if you know how can I run a python code once every five | minutes for a period of time either using python or some other program like | a bash script. I expect the following should work. from time impo

  1   2   3   >