Re: Finding a sense of word in a text

2008-06-13 Thread Sengly
Thanks a lot everyone. I appreciate your suggestion. But still, I could not find a simple way using wordnet since each term might have several part of speech and each one of them can have many senses. What I want is simply the list of synonyms of each term with their popularity score in English te

Re: numpy: handling float('NaN') different in XP vs. Linux

2008-06-13 Thread John [H2O]
John Machin wrote: > > > Avoid impolite astonishment; RTFloatingM instead: > """ > > HTH, > John > -- > > I guess the key here is that it is not an issue with Python, but C... can I change 'the underlying C code?' if so, WFM should I read for that!? :p -- View this message in context:

Re: struct unpack issue

2008-06-13 Thread Miles
On Fri, Jun 13, 2008 at 9:27 PM, Ping Zhao <[EMAIL PROTECTED]> wrote: > However, when I tried to rewrite them in short: > > header = struct.unpack('2s1i', self.__read(src, 6)) > ... > It was weired that the required argument length increased to 8. This is an alignment issue; if you don't specify a

Re: Is there a web-editor I can use with Python?

2008-06-13 Thread I V
On Fri, 13 Jun 2008 22:10:51 +0100, Ognjen Bezanov wrote: > I am building an application using WxWidgets, and its job is to manage > HTML data in a database. Now I need essentially a HTML editor that I can > embed into my program, that will parse the HTML and allow the user to > edit it. How about

Re: numpy: handling float('NaN') different in XP vs. Linux

2008-06-13 Thread John Machin
On Jun 14, 1:45 pm, "John [H2O]" <[EMAIL PROTECTED]> wrote: > I have a script: > > from numpy import float > OutD=[] > v=['3','43','23.4','NaN','43'] > OutD.append([float(i) for i in v[1]]) > > On linux: > Python 2.5.1 (r251:54863, Mar 7 2008, 04:10:12) > [GCC 4.1.3 20070929 (prerelease) (Ubuntu 4

Re: numpy: handling float('NaN') different in XP vs. Linux

2008-06-13 Thread Dan Bishop
On Jun 13, 10:45 pm, "John [H2O]" <[EMAIL PROTECTED]> wrote: > I have a script: > > from numpy import float > OutD=[] > v=['3','43','23.4','NaN','43'] > OutD.append([float(i) for i in v[1]]) > > On linux: > Python 2.5.1 (r251:54863, Mar  7 2008, 04:10:12) > [GCC 4.1.3 20070929 (prerelease) (Ubuntu

Re: Best way to make a number of tests against an object('s attributes) with absence of switch statement?

2008-06-13 Thread John Machin
On Jun 14, 12:25 pm, Phillip B Oldham <[EMAIL PROTECTED]> wrote: > What would be the optimal/pythonic way to subject an object to a > number of tests (based on the object's attributes) and redirect > program flow? > > Say I had the following: > > pets[0] = {'name': 'fluffy', 'species': 'cat', 'size

numpy: handling float('NaN') different in XP vs. Linux

2008-06-13 Thread John [H2O]
I have a script: from numpy import float OutD=[] v=['3','43','23.4','NaN','43'] OutD.append([float(i) for i in v[1]]) On linux: Python 2.5.1 (r251:54863, Mar 7 2008, 04:10:12) [GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2 [EMAIL PROTECTED] analysis]$ python jnk.py [[3.0,

Best way to make a number of tests against an object('s attributes) with absence of switch statement?

2008-06-13 Thread Phillip B Oldham
What would be the optimal/pythonic way to subject an object to a number of tests (based on the object's attributes) and redirect program flow? Say I had the following: pets[0] = {'name': 'fluffy', 'species': 'cat', 'size': 'small'} pets[1] = {'name': 'bruno', 'species': 'snake', 'size': 'small'}

Re: Making HEAD/PUT/DELETE requests with urllib2?

2008-06-13 Thread Phillip B Oldham
Thanks for the info. That's working like a charm. Looks as though I'll be able to handle all request types with that object. I got a little worried then that the python dev's had missed something truly important! -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 3000 vs. Python 2.x

2008-06-13 Thread Christian Heimes
[EMAIL PROTECTED] wrote: > As a new comer to Python I was wondering which is the best to start > learning. I've read that a number of significant features have > changed between the two versions. Yet, the majority of Python > programs out in the world are 2.x and it would be nice to understand >

Re: Another (perhaps similar) import question

2008-06-13 Thread Dan Yamins
>> >> > > Please keep responses to python-list discussion on python-list, not my > personal mail box. -- Thanks. > Sorry. When I hit "reply" on gmail to your message, your personal email comes up as opposed to the python list address. My apologies for not looking for closely. > I'd suggest u

Re: Python Socket programming

2008-06-13 Thread William McBrine
On Fri, 13 Jun 2008 21:59:06 +0530, srinivasan srinivas wrote: > I am going to do some socket related programming in Python. Before that, > I wish to know the Gotchas of Python Scoket Programming. The only gotcha I see is that you won't want to go back to doing it in C. -- 09 F9 11 02 9D 74 E3

Re: A package import question

2008-06-13 Thread Dan Yamins
You have removed the "archive" attribute from the object to which the > "Operations" name is referring to. > >>>> import Operations.archive >> > > Python keeps a reference to all imported modules in sys.modules; if a > module was already imported, any subsequent imports of the same module just

Re: Another (perhaps similar) import question

2008-06-13 Thread Gary Herron
Dan Yamins wrote: What is the principle behind this? And, is there some simple way (other than restarting the interpreter) of "reloading" that wipes out the old attributes associated with a given name so that spurious attributes do not remain? No. Con

Re: python compilation on macosx with icc

2008-06-13 Thread Martin v. Löwis
> checking for wchar.h... yes > checking for wchar_t... yes > checking size of wchar_t... configure: error: cannot compute sizeof (wchar_t) > > what can I do ? Read config.log. If that doesn't help, use gcc. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: A package import question

2008-06-13 Thread Gabriel Genellina
En Fri, 13 Jun 2008 20:01:56 -0300, Dan Yamins <[EMAIL PROTECTED]> escribió: I'm having a problem importing a package in python, deleting some of what's been imported, and then reimporting. (I'm the sure the problem is trivial, but I just don't understand it.) I have a directory of pytho

Re: importing part of a module without executing the rest

2008-06-13 Thread Ben Finney
[EMAIL PROTECTED] writes: > file1.py > -- > a = 20 > from abc import * > print "Should this be printed when 'a' is alone imported from this > module" > > file2.py > -- > from file1 import a > print a > > file2.py is used in a context where 'from abc import *' statement > doesn't

Re: Subclassing list, what special methods do this?

2008-06-13 Thread Matimus
On Jun 13, 11:38 am, Mike Kent <[EMAIL PROTECTED]> wrote: > For Python 2.5 and new-style classes, what special method is called > for mylist[2:4] = seq and for del mylist[2:4] (given that mylist is a > list, and seq is some sequence)? > > I'm trying to subclass list, and I'm having trouble determin

Re: Subclassing list, what special methods do this?

2008-06-13 Thread Gabriel Genellina
En Fri, 13 Jun 2008 15:38:15 -0300, Mike Kent <[EMAIL PROTECTED]> escribió: For Python 2.5 and new-style classes, what special method is called for mylist[2:4] = seq and for del mylist[2:4] (given that mylist is a list, and seq is some sequence)? I'm trying to subclass list, and I'm having trou

Re: Another (perhaps similar) import question

2008-06-13 Thread Gary Herron
Dan Yamins wrote: I also have noticed another (to me) strange thing about module imports. If anyone could explain this to me, that would be great (I apologize if it's too elementary for this list.) Suppose I have a module #file: testmodule.py a = 1 When importing this module, obviously

Re: Making HEAD/PUT/DELETE requests with urllib2?

2008-06-13 Thread Jeff McNeil
The only time I've ever pulled a HEAD request I've used the httplib module directly. Ought to be able to do it like so: Python 2.5.1 (r251:54863, Jan 17 2008, 19:35:17) [GCC 4.0.1 (Apple Inc. build 5465)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import h

Making HEAD/PUT/DELETE requests with urllib2?

2008-06-13 Thread Phillip B Oldham
In my attempt to learn python in a weekend, I've fallen foul at line 10 of my second scripting attempt. Basically I'm writing a simple spider, but currently I'm unable to find any documentation on making HEAD requests using the urllib2 library to test whether a file exists on a remote webserver. I

Another (perhaps similar) import question

2008-06-13 Thread Dan Yamins
I also have noticed another (to me) strange thing about module imports. If anyone could explain this to me, that would be great (I apologize if it's too elementary for this list.) Suppose I have a module #file: testmodule.py a = 1 When importing this module, obviously 'a' becomes an attrib

Re: Python 3000 vs. Python 2.x

2008-06-13 Thread George Sakkis
On Jun 13, 5:04 pm, [EMAIL PROTECTED] wrote: > As a new comer to Python I was wondering which is the best to start > learning. I've read that a number of significant features have > changed between the two versions. Yet, the majority of Python > programs out in the world are 2.x and it would be

Re: importing part of a module without executing the rest

2008-06-13 Thread George Sakkis
On Jun 13, 5:52 pm, [EMAIL PROTECTED] wrote: > file1.py > -- > a = 20 > from abc import * > print "Should this be printed when 'a' is alone imported from this > module" > > file2.py > -- > from file1 import a > print a > > (snipped) > > Of course, the option of using if __name__ ==

A package import question

2008-06-13 Thread Dan Yamins
I'm having a problem importing a package in python, deleting some of what's been imported, and then reimporting. (I'm the sure the problem is trivial, but I just don't understand it.) I have a directory of python modules called Operations. It contains a python module called archive.py.Here's

Re: Finding a sense of word in a text

2008-06-13 Thread George Sakkis
On Jun 11, 1:10 pm, Sengly <[EMAIL PROTECTED]> wrote: > Dear all, > > This might be off group but I am looking for a python library that can > help me to find a sense of a word in a text and eventually a list of > synonyms of that term. I searched the web and found one but it is > written in perl (

Re: Python 3000 vs. Python 2.x

2008-06-13 Thread Matt Nordhoff
[EMAIL PROTECTED] wrote: > As a new comer to Python I was wondering which is the best to start > learning. I've read that a number of significant features have > changed between the two versions. Yet, the majority of Python > programs out in the world are 2.x and it would be nice to understand >

Re: Python 3000 vs. Python 2.x

2008-06-13 Thread Terry Reedy
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | As a new comer to Python I was wondering which is the best to start | learning. I've read that a number of significant features have | changed between the two versions. Yet, the majority of Python | programs out in the world are 2.x

Re: How to sort very large arrays?

2008-06-13 Thread Terry Reedy
"kj" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | I'm downloading some very large tables from a remote site. I want | to sort these tables in a particular way before saving them to | disk. In the past I found that the most efficient way to do this | was to piggy-back on Unix's

Re: why can i still able to reproduce the SimpleHTTPServer bug whichis said fixed 3 years ago?

2008-06-13 Thread Terry Reedy
"Gabriel Genellina" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] En Fri, 13 Jun 2008 04:02:48 -0300, Leo Jay <[EMAIL PROTECTED]> escribió: > http://bugs.python.org/issue1097597 > > in my python 2.5.2, i still find these code in SimpleHTTPServer.py, > is that deliberate? Accordin

importing part of a module without executing the rest

2008-06-13 Thread krishna . 000 . k
file1.py -- a = 20 from abc import * print "Should this be printed when 'a' is alone imported from this module" file2.py -- from file1 import a print a file2.py is used in a context where 'from abc import *' statement doesn't make sense but it can make sense of (and requires) 'a'

Re: Point Of intersection between two plotted functions

2008-06-13 Thread Terry Reedy
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | Is there anyway one could find ot the point of intersection between | any two plotted functions Assume you have sequence xi, yi, zi, where yi and zi are function values corresponding to xi. In general, you will never have exact inter

Re: does paramiko support python2.5?

2008-06-13 Thread Michael Mabin
paramiko is an ssh module On Fri, Jun 13, 2008 at 2:49 PM, Terry Reedy <[EMAIL PROTECTED]> wrote: > > "Praveena B" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > when i used paramiko in python2.5 i got the error below. > File "C:\praveena\python scripts\sshlib\ssh.py", line 5, i

python compilation on macosx with icc

2008-06-13 Thread Mathieu Prevot
Hi, when I run configure, it fails at: checking for wchar.h... yes checking for wchar_t... yes checking size of wchar_t... configure: error: cannot compute sizeof (wchar_t) what can I do ? Thanks, Mathieu -- http://mail.python.org/mailman/listinfo/python-list

Re: ClassName.attribute vs self.__class__.attribute

2008-06-13 Thread Terry Reedy
"> One metaclass (i.e. type) has a class attribute that refers to itself. > > Other metaclasses have a class attribute that refers to the metaclass's > metaclass. I can't think of any situation where a metaclass would be its > own metaclass except for 'type' itself, but then I think I've got a >

Re: python screen scraping/parsing

2008-06-13 Thread Paul Boddie
On 13 Jun, 23:09, "bruce" <[EMAIL PROTECTED]> wrote: > > Thanks for the reply. Came to the same conclusion a few minutes before I saw > your email. > > Another question: > > tr=d.xpath(foo) > > gets me an array of nodes. > > is there a way for me to then iterate through the node tr[x] to see if a >

Re: Python 3000 vs. Python 2.x

2008-06-13 Thread mr . opus . penguin
On Jun 13, 4:13 pm, Mensanator <[EMAIL PROTECTED]> wrote: > On Jun 13, 4:04 pm, [EMAIL PROTECTED] wrote: > > > As a new comer to Python I was wondering which is the best to start > > learning. I've read that a number of significant features have > > changed between the two versions. Yet, the majo

Re: Python 3000 vs. Python 2.x

2008-06-13 Thread Mensanator
On Jun 13, 4:04 pm, [EMAIL PROTECTED] wrote: > As a new comer to Python I was wondering which is the best to start > learning.  I've read that a number of significant features have > changed between the two versions.  Yet, the majority of Python > programs out in the world are 2.x and it would be n

Is there a web-editor I can use with Python?

2008-06-13 Thread Ognjen Bezanov
Hello Everyone! I am building an application using WxWidgets, and its job is to manage HTML data in a database. Now I need essentially a HTML editor that I can embed into my program, that will parse the HTML and allow the user to edit it. Many of these 'WYSIWYG' HTML editors exist for other lang

RE: python screen scraping/parsing

2008-06-13 Thread bruce
Hi Paul... Thanks for the reply. Came to the same conclusion a few minutes before I saw your email. Another question: tr=d.xpath(foo) gets me an array of nodes. is there a way for me to then iterate through the node tr[x] to see if a child node exists??? "d" is a document object, while "tr" w

Python 3000 vs. Python 2.x

2008-06-13 Thread mr . opus . penguin
As a new comer to Python I was wondering which is the best to start learning. I've read that a number of significant features have changed between the two versions. Yet, the majority of Python programs out in the world are 2.x and it would be nice to understand those as well. Thanks for all the

Re: Converting a simple python script to a simple windows executable

2008-06-13 Thread geoffbache
Thanks for all the suggestions. I have eventually used a heavily edited version of ExeMaker which seems to do what I want. Geoff -- http://mail.python.org/mailman/listinfo/python-list

Re: Mapping None. Why?

2008-06-13 Thread Ian Kelly
On Fri, Jun 13, 2008 at 2:00 PM, Terry Reedy <[EMAIL PROTECTED]> wrote: > filter(None, iterable) works the same way: None-> identity function, > The immediate reason is the Python has no builtin id(). > But apparently there is also historical precedent in the functional > community for this convent

Re: does paramiko support python2.5?

2008-06-13 Thread [EMAIL PROTECTED]
On Jun 13, 3:49 pm, "Terry Reedy" <[EMAIL PROTECTED]> wrote: > "Praveena B" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > when i used paramiko in python2.5 i got the error below. > File "C:\praveena\python scripts\sshlib\ssh.py", line 5, in > import paramiko ... > from osrandom

Re: Mapping None. Why?

2008-06-13 Thread Terry Reedy
"David C. Ullrich" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | In article | <[EMAIL PROTECTED]>, | Paddy <[EMAIL PROTECTED]> wrote: | | > True, but None is not a function. It's a sentinel value to turn on the | > functionality. | | Uh, thanks. I think I knew that - I was just su

Re: does paramiko support python2.5?

2008-06-13 Thread Terry Reedy
"Praveena B" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] when i used paramiko in python2.5 i got the error below. File "C:\praveena\python scripts\sshlib\ssh.py", line 5, in import paramiko File "C:\Python25\Lib\site-packages\paramiko\__init__.py", line 69, in from transport im

Re: python screen scraping/parsing

2008-06-13 Thread Paul Boddie
On 13 Jun, 20:10, "bruce" <[EMAIL PROTECTED]> wrote: > > url ="http://www.pricegrabber.com/rating_summary.php/page=1"; [...] > tr = > "/html/body/[EMAIL PROTECTED]'pgSiteContainer']/[EMAIL > PROTECTED]'pgPageContent']/table[2]/tbo > dy/tr[4]" > > tr_=d.xpath(tr) [...] > my issu

Re: Iterate creating variables?

2008-06-13 Thread Jason Scheirer
On Jun 13, 8:11 am, [EMAIL PROTECTED] wrote: > I have twenty-five checkboxes I need to create (don't ask): > > self.checkbox1 = ... > self.checkbox2 = ... > . > . > . > self.checkbox25 = ... > > Right now, my code has 25 lines in it, one for each checkbox, since > these are all variables. > > Is th

Subclassing list, what special methods do this?

2008-06-13 Thread Mike Kent
For Python 2.5 and new-style classes, what special method is called for mylist[2:4] = seq and for del mylist[2:4] (given that mylist is a list, and seq is some sequence)? I'm trying to subclass list, and I'm having trouble determining what special methods I have to override in my class for the abo

Re: best way to create a timer

2008-06-13 Thread Giampaolo Rodola'
On 13 Giu, 07:42, Alexnb <[EMAIL PROTECTED]> wrote: > I am wondering what is the best way to create a timer, like an alarm, once it > reaches a time, it triggers an event. I have a way of doing this but it > seems like it isn't good at all. If it helps at all I am using a Tkinter, > but that probab

Re: python screen scraping/parsing

2008-06-13 Thread Dan Stromberg
BeautifulSoup is a pretty nice python module for screen scraping (not necessarily well formed) web pages. On Fri, 13 Jun 2008 11:10:09 -0700, bruce wrote: > Hi... > > got a short test app that i'm playing with. the goal is to get data off > the page in question. > > basically, i should be abl

Re: How to sort very large arrays?

2008-06-13 Thread Dan Stromberg
On Fri, 13 Jun 2008 17:54:32 +, kj wrote: > I'm downloading some very large tables from a remote site. I want to > sort these tables in a particular way before saving them to disk. In > the past I found that the most efficient way to do this was to > piggy-back on Unix's highly optimized sor

Re: Python Socket programming

2008-06-13 Thread Dan Stromberg
On Fri, 13 Jun 2008 21:59:06 +0530, srinivasan srinivas wrote: > Hi, > I am going to do some socket related programming in Python. Before that, > I wish to know the Gotchas of Python Scoket Programming. Can anyone send > me any link that satisfies my needs?? Thanks, > Srini > > > Explore y

RE: Python-list Digest, Vol 57, Issue 206

2008-06-13 Thread STEVEN A JACKSON
Is there a Python programmer living near Bend Oregon that I could call via phone & ask some questions on how they accomplish certain tasks? I’ve been programming using several languages for over fifty years, but am unable to get Python to due what I would like to do! Papa Jackson From: [EMAIL

Re: Python Socket programming

2008-06-13 Thread Vishang Shah
there is this good link for explanation on how sockets work, http://www.tutorialgrub.com/tutorials/Python/Development/Socket-Programming-HOWTO_325.html -- http://mail.python.org/mailman/listinfo/python-list

os.startfile() on a mac

2008-06-13 Thread Alexnb
So i have a mac and pc, and just found out that os.startfile() doesn't work on a mac. So is there anything like that besides os.system()? -- View this message in context: http://www.nabble.com/os.startfile%28%29-on-a-mac-tp17829335p17829335.html Sent from the Python - python-list mailing list a

python screen scraping/parsing

2008-06-13 Thread bruce
Hi... got a short test app that i'm playing with. the goal is to get data off the page in question. basically, i should be able to get a list of "tr" nodes, and then to iterate/parse them. i'm missing something, as i think i can get a single node, but i can't figure out how to display the content

How to sort very large arrays?

2008-06-13 Thread kj
I'm downloading some very large tables from a remote site. I want to sort these tables in a particular way before saving them to disk. In the past I found that the most efficient way to do this was to piggy-back on Unix's highly optimized sort command. So, from within a Perl script, I'd creat

Re: Ultimate Prime Sieve -- Sieve Of Zakiya (SoZ)

2008-06-13 Thread jzakiya
On Jun 13, 1:12 pm, jzakiya <[EMAIL PROTECTED]> wrote: > This is to announce the release of my paper "Ultimate Prime Sieve -- > Sieve of Zakiiya (SoZ)" in which I show and explain the development of > a class of Number Theory Sieves to generate prime numbers.   I used > Ruby 1.9.0-1 as my developme

Re: GIL cpu multi core usage problem

2008-06-13 Thread Gabriel Genellina
En Fri, 13 Jun 2008 08:55:30 -0300, Pau Freixes <[EMAIL PROTECTED]> escribió: When you say this "C extensions (usually) release the GIL when they don't call into any Python code" do you talk about this macros ? Py_BEGIN_ALLOW_THREADS Py_END_ALLOW_THREADS Exactly. -- Gabriel Genellina --

Ultimate Prime Sieve -- Sieve Of Zakiya (SoZ)

2008-06-13 Thread jzakiya
This is to announce the release of my paper "Ultimate Prime Sieve -- Sieve of Zakiiya (SoZ)" in which I show and explain the development of a class of Number Theory Sieves to generate prime numbers. I used Ruby 1.9.0-1 as my development environment on a P4 2.8 Ghz laptop. You can get the pdf of

Re: struct unpack issue

2008-06-13 Thread Peter Otten
Ping Zhao wrote: > I am writing a small program to decode MS bitmap image. When I use > statements as follow, it works fine: > > header['sig'] = str(struct.unpack('2s', self.__read(src, 2))[0]) > header['len'] = int(struct.unpack('1i', self.__read(src, 4))[0]) > > However, when I tried to rewr

Re: Mapping None. Why?

2008-06-13 Thread David C. Ullrich
In article <[EMAIL PROTECTED]>, Paddy <[EMAIL PROTECTED]> wrote: > On Jun 13, 12:49 pm, David C. Ullrich <[EMAIL PROTECTED]> wrote: > > On Thu, 12 Jun 2008 12:05:02 -0700 (PDT), Paddy > > > > <[EMAIL PROTECTED]> wrote: > > > > >Iam wondering why the peculiar behavior of map when the function in

Re: Finding a sense of word in a text

2008-06-13 Thread Peter Otten
Sengly wrote: > Thank you. I have tried but no luck :( NLTK, maybe? Searching for "synonym" within nltk.org gives http://nltk.org/doc/en/words.html Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: weird iteration/assignment problem

2008-06-13 Thread Matimus
On Jun 13, 8:07 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > cirfu schrieb: > > > for i in xrange(0, len(texts)): > > texts[i] = "yes" > > > for i in texts: > > i = "no" > > > why is the first one working but not the second. i mean i see why the > > firts one works but i dont udn

Re: Summing a 2D list

2008-06-13 Thread Maric Michaud
Le Friday 13 June 2008 18:55:24 Maric Michaud, vous avez écrit : > > approximately the double amount of memory compared to the other. > > I don't see how you came to this conclusion. Are you sure the extra list > take twice more memory than the extra dictionary ? twice less, I meant, of course...

Re: Summing a 2D list

2008-06-13 Thread Maric Michaud
Hello, Le Friday 13 June 2008 17:55:44 Karsten Heymann, vous avez écrit : > Maric Michaud <[EMAIL PROTECTED]> writes: > > So, writing C in python, which has dictionnary as builtin type, > > should be considered "more elegant" ? > > IMO that's a bit harsh. > harsh ? Sorry, I'm not sure to understa

Re: Python Socket programming

2008-06-13 Thread Cédric Lucantis
Hi, Le Friday 13 June 2008 18:29:06 srinivasan srinivas, vous avez écrit : > Hi, > I am going to do some socket related programming in Python. Before that, I > wish to know the Gotchas of Python Scoket Programming. Can anyone send me > any link that satisfies my needs?? Yes, the friendly manual :

Automatically restarting system calls?

2008-06-13 Thread Dan Stromberg
I wrote a script(1) replacement in python (http://stromberg.dnsalias.org/ ~dstromberg/pypty/), but I'm encountering a problem in it. I think I know the solution to the problem, but I'd've thought python was high level enough that this solution isn't required, so I wanted to inquire about it her

RE: namedtuple suggestions

2008-06-13 Thread Jason R. Coombs
I also agree with your point on concatting. I used that syntax because it seemed more clear, given the already awkward syntax. And while the original motivation of namedtuple might be to avoid having to make a class or subclass, subclasses have already emerged even within the standard library (se

Python Socket programming

2008-06-13 Thread srinivasan srinivas
Hi, I am going to do some socket related programming in Python. Before that, I wish to know the Gotchas of Python Scoket Programming. Can anyone send me any link that satisfies my needs?? Thanks, Srini Explore your hobbies and interests. Go to http://in.promos.yahoo.com/groups/ -- http://

Re: Iterate creating variables?

2008-06-13 Thread tdahsu
On Jun 13, 12:19 pm, Calvin Spealman <[EMAIL PROTECTED]> wrote: > On Jun 13, 2008, at 11:56 AM, [EMAIL PROTECTED] wrote: > > > > > On Jun 13, 11:48 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > >> [EMAIL PROTECTED] schrieb: > > >>> On Jun 13, 11:21 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> w

struct unpack issue

2008-06-13 Thread Ping Zhao
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi, I am writing a small program to decode MS bitmap image. When I use statements as follow, it works fine: header['sig'] = str(struct.unpack('2s', self.__read(src, 2))[0]) header['len'] = int(struct.unpack('1i', self.__read(src, 4))[0]) However,

Re: Iterate creating variables?

2008-06-13 Thread Calvin Spealman
On Jun 13, 2008, at 11:56 AM, [EMAIL PROTECTED] wrote: On Jun 13, 11:48 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: [EMAIL PROTECTED] schrieb: On Jun 13, 11:21 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: [EMAIL PROTECTED] schrieb: I have twenty-five checkboxes I need to cre

Re: Iterate creating variables?

2008-06-13 Thread tdahsu
On Jun 13, 12:03 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > > Thank you, this is much closer to where I need to be... > > > The issue is (and this is the part that you don't know, because I > > didn't tell you!) is that I later need to call methods on > > "self.checkbox1", for instance: >

Re: namedtuple suggestions

2008-06-13 Thread Calvin Spealman
On Jun 13, 2008, at 11:17 AM, Jason R. Coombs wrote: I see a new function in (python 2.6) lib/collections called namedtuple. This is a great function. I can see many places in my code where this will be immensely useful. I have a couple of suggestions. My first suggestion is to use self.__cl

Re: Finding a sense of word in a text

2008-06-13 Thread Sengly
Thank you. I have tried but no luck :( Regards, Sengly -- http://mail.python.org/mailman/listinfo/python-list

Re: urllib (54, 'Connection reset by peer') error

2008-06-13 Thread Jeff McNeil
It means your client received a TCP segment with the reset bit sent. The 'peer' will toss one your way if it determines that a connection is no longer valid or if it receives a bad sequence number. If I had to hazard a guess, I'd say it's probably a network device on the server side trying to stop

Re: Python noob's simple config problem

2008-06-13 Thread kj
In <[EMAIL PROTECTED]> =?iso-8859-1?q?Robin_K=E5veland?= Hansen <[EMAIL PROTECTED]> writes: >On Thu, 12 Jun 2008 21:32:34 +, kj wrote: >> I'm sure this is a simple, but recurrent, problem for which I can't hit >> on a totally satisfactory solution. >> >> As an example, suppose that I want w

Re: Iterate creating variables?

2008-06-13 Thread Diez B. Roggisch
Thank you, this is much closer to where I need to be... The issue is (and this is the part that you don't know, because I didn't tell you!) is that I later need to call methods on "self.checkbox1", for instance: self.checkbox1.GetValue() to determine if the box is checked or not. I should hav

Re: Summing a 2D list

2008-06-13 Thread Karsten Heymann
Hi Maric, Maric Michaud <[EMAIL PROTECTED]> writes: > So, writing C in python, which has dictionnary as builtin type, > should be considered "more elegant" ? IMO that's a bit harsh. > You are comparing apples with lemons, there is no such a difference > between list index access and dictionnary

Re: Iterate creating variables?

2008-06-13 Thread tdahsu
On Jun 13, 11:48 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] schrieb: > > > > > On Jun 13, 11:21 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > >> [EMAIL PROTECTED] schrieb: > > >>> I have twenty-five checkboxes I need to create (don't ask): > >>> self.checkbox1 = ...

Re: pgdb connection string

2008-06-13 Thread Mel
Johannes Bauer wrote: > I'm trying to initialize a connection to a PG database. So help(pgdb) > says: > > pgdb.connect(connect_string) -> connection > connect_string = 'host:database:user:password:opt:tty' > All parts are optional. You may also pass host through >

Re: Iterate creating variables?

2008-06-13 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: On Jun 13, 11:21 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: [EMAIL PROTECTED] schrieb: I have twenty-five checkboxes I need to create (don't ask): self.checkbox1 = ... self.checkbox2 = ... . . . self.checkbox25 = ... Right now, my code has 25 lines in it, on

Re: Iterate creating variables?

2008-06-13 Thread tdahsu
On Jun 13, 11:21 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] schrieb: > > > > > I have twenty-five checkboxes I need to create (don't ask): > > > self.checkbox1 = ... > > self.checkbox2 = ... > > . > > . > > . > > self.checkbox25 = ... > > > Right now, my code has 25 lines

RE: Iterate creating variables?

2008-06-13 Thread Reedick, Andrew
> -Original Message- > From: [EMAIL PROTECTED] [mailto:python- > [EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] > Sent: Friday, June 13, 2008 11:11 AM > To: python-list@python.org > Subject: Iterate creating variables? > > I have twenty-five checkboxes I need to create (don't ask): >

RE: Iterate creating variables?

2008-06-13 Thread Reedick, Andrew
> -Original Message- > From: [EMAIL PROTECTED] [mailto:python- > [EMAIL PROTECTED] On Behalf Of Diez B. Roggisch > Sent: Friday, June 13, 2008 11:21 AM > To: python-list@python.org > Subject: Re: Iterate creating variables? > > [EMAIL PROTECTED] schrieb: > > I have twenty-five checkboxes

Re: Summing a 2D list

2008-06-13 Thread Karsten Heymann
Paddy <[EMAIL PROTECTED]> writes: > How does your solution fare against the defaultdict solution of: > > d = collections.defaultdict(int) > for u,s in zip(users,score): d[u] += s list: 0.931s dict + "in": 1.495s defaultdict : 1.991s dict + "if": ~2s dict + "try": ~4s I've posted the (ve

Re: TypeError with date class

2008-06-13 Thread Cédric Lucantis
Hi, Le Friday 13 June 2008 15:24:31 Dummy Pythonese Luser, vous avez écrit : > Greetings *.*: > > The following program caused an error and puzzled me to no end. Any help > immensely appreciated. > > > class Second(First): > def __init__(self, datestr): > y = int(datestr[0:4]) > m = int(

Re: Comments on my first script?

2008-06-13 Thread Lie
On Jun 13, 3:19 pm, Bruno Desthuilliers wrote: > Phillip B Oldham a écrit : > > > I'm keen on learning python, with a heavy lean on doing things the > > "pythonic" way, so threw the following script together in a few hours > > as a first-attempt in programming python. > > > I'd like the community'

Re: Iterate creating variables?

2008-06-13 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: I have twenty-five checkboxes I need to create (don't ask): self.checkbox1 = ... self.checkbox2 = ... . . . self.checkbox25 = ... Right now, my code has 25 lines in it, one for each checkbox, since these are all variables. Is there a way to write a loop so that I can

namedtuple suggestions

2008-06-13 Thread Jason R. Coombs
I see a new function in (python 2.6) lib/collections called namedtuple. This is a great function. I can see many places in my code where this will be immensely useful. I have a couple of suggestions. My first suggestion is to use self.__class__.__name__ instead of the hard-coded typename in __r

Iterate creating variables?

2008-06-13 Thread tdahsu
I have twenty-five checkboxes I need to create (don't ask): self.checkbox1 = ... self.checkbox2 = ... . . . self.checkbox25 = ... Right now, my code has 25 lines in it, one for each checkbox, since these are all variables. Is there a way to write a loop so that I can have fewer lines of code but

Re: Summing a 2D list

2008-06-13 Thread Maric Michaud
Le Friday 13 June 2008 14:12:40 Karsten Heymann, vous avez écrit : > Hi Mark, > > Mark <[EMAIL PROTECTED]> writes: > > I have a scenario where I have a list like this: > > > > User            Score > > 1                 0 > > 1                 1 > > 1                 5 > > 2                 3 > > 2

Re: Comments on my first script?

2008-06-13 Thread Lie
On Jun 12, 10:10 pm, "John Salerno" <[EMAIL PROTECTED]> wrote: > "Phillip B Oldham" <[EMAIL PROTECTED]> wrote in messagenews:[EMAIL PROTECTED] > > > I'd like the community's thoughts/comments on what I've done; > > improvements I can make, "don'ts" I should be avoiding, etc. I'm not > > so much bot

Re: weird iteration/assignment problem

2008-06-13 Thread Diez B. Roggisch
cirfu schrieb: for i in xrange(0, len(texts)): texts[i] = "yes" for i in texts: i = "no" why is the first one working but not the second. i mean i see why the firts one works but i dont udnerstand why the second doesnt. Because in the second you only bind the contents of texts to

weird iteration/assignment problem

2008-06-13 Thread cirfu
for i in xrange(0, len(texts)): texts[i] = "yes" for i in texts: i = "no" why is the first one working but not the second. i mean i see why the firts one works but i dont udnerstand why the second doesnt. -- http://mail.python.org/mailman/listinfo/python-list

Re: Summing a 2D list

2008-06-13 Thread Paddy
On Jun 13, 1:12 pm, Karsten Heymann <[EMAIL PROTECTED]> wrote: > Hi Mark, > > > > Mark <[EMAIL PROTECTED]> writes: > > I have a scenario where I have a list like this: > > > UserScore > > 1 0 > > 1 1 > > 1 5 > > 2 3 > > 2

  1   2   >