Re: can't assign to literal

2008-06-13 Thread TheSaint
On 15:11, giovedì 12 giugno 2008 Dennis Lee Bieber wrote: > Word spaced line justification is only feasible if one is using a > fixed width font and have a line length defined in "characters/line". ===8<==8<==8<==8<==8<==8<==8<==8<==8<==8< line= 'fixed width f

Re: ClassName.attribute vs self.__class__.attribute

2008-06-13 Thread Bruno Desthuilliers
Duncan Booth a écrit : Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: FWIW, metaclasses do have a class attribute that refers to itself !-) 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 metacl

why can i still able to reproduce the SimpleHTTPServer bug which is said fixed 3 years ago?

2008-06-13 Thread Leo Jay
http://bugs.python.org/issue1097597 in my python 2.5.2, i still find these code in SimpleHTTPServer.py, is that deliberate? ctype = self.guess_type(path) if ctype.startswith('text/'): mode = 'r' else: mode = 'rb' try: f = open(pa

Re: FPC: Exception : Unknown Run-Time error : 210

2008-06-13 Thread Gabriel Genellina
En Thu, 12 Jun 2008 12:38:34 -0300, Sa¹a Bistroviæ <[EMAIL PROTECTED]> escribió: FPC: Exception : Unknown Run-Time error : 210 Wrong list... you are probably looking for http://lists.freepascal.org/mailman/listinfo/fpc-pascal/ -- Gabriel Genellina -- http://mail.python.org/mailman/li

My editing style (was: can't assign to literal)

2008-06-13 Thread TheSaint
On 14:49, giovedì 12 giugno 2008 Chris wrote: > You should strip all extraneous white space from code though. For my taste, trailing spaces will be removed by my editor (Kate :) ) Other space tabulators are an issue which won't suite my needs. -- Mailsweeper Home : http://it.geocities.com/call_

Re: best way to create a timer

2008-06-13 Thread subhabrata . iisc
You can think of doing with import time module and time.sleep(n) but you have to calculate n in seconds. Subhabrata. Alexnb 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

HTML FORM AND PYTHON

2008-06-13 Thread subhabrata . iisc
Dear Members of the group, I have a small question, if you can help me to find the answer. I have one function: def add_string(n): print “Print Two strings” print “Print the First String” a1=raw_input(“PRINT THE FIRST STRING”) a2=raw_input(“PRINT THE SECOND STRING”)

error showing file not found

2008-06-13 Thread bioinf
Hi, I am new to python.I have installed Biopython in Windows.I am working using IDLE.When I want to get structure of local pdb file it is showing error that "no such file or directory".Can anybody tell what is the problem. -- This message has been scanned for viruses and dangerous content by Mai

Re: Plotting Graphs + Bestfit lines

2008-06-13 Thread Peter Otten
[EMAIL PROTECTED] wrote: > Umm Tried this out too Laiken heres the error that this > gives.. > > Traceback (most recent call last): > File "D:\Questions\Gradient and C\Gnuplot\Combining Best fit and > Plotting\combasd.py", line 3, in > combine.show_plots([(2,3), (4,8), (5,9), (6,2)

Re: hi

2008-06-13 Thread subhabrata . iisc
Islam is a nice religion if you read The quran. Militancy is their in every religion. But unfortunately, Islam is getting a bad name. It is good to see that some one like you is trying to let us know the good part of it. But this may not be a room for that. You might have been wrongly directed here

Re: Plotting Graphs + Bestfit lines

2008-06-13 Thread arslanburney
On Jun 13, 12:13 pm, Peter Otten <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > Umm Tried this out too Laiken heres the error that this > > gives.. > > > Traceback (most recent call last): > >   File "D:\Questions\Gradient and C\Gnuplot\Combining Best fit and > > Plotting\combasd

Re: error showing file not found

2008-06-13 Thread subhabrata . iisc
You can see the file whether it is loaded in C:\Python and you entered it correctly. Problem should not occur. Else you may refer Python docs for Error and Exception handling. Regs, Subhabrata. [EMAIL PROTECTED] wrote: > Hi, > I am new to python.I have installed Biopython in Windows.I am working >

Re: How to set directory in save as combo box

2008-06-13 Thread Gabriel Genellina
En Fri, 13 Jun 2008 01:55:58 -0300, gopal mishra <[EMAIL PROTECTED]> escribió: I am trying to save a file, it is working fine. But if the file is not on the foreground while setting combo box directory, changing the value in the combo box by setLookIn() appear on the foreground window.

ANN: pdfposter 0.4.2

2008-06-13 Thread Hartmut Goebel
I'm pleased to announce pdfposter 0.4.2, a tool to scale and tile PDF images/pages to print on multiple pages. http://pdfposter.origo.ethz.ch/download/ This version fixes a view minor bugs - some media-/poster-sizes (eg. Letter) have not beeb recogniced - some PDF files crashed the tool. Down

does paramiko support python2.5?

2008-06-13 Thread Praveena B
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 import randpool, SecurityOptions, Transport   File "C:\Python25\L

Debuggers

2008-06-13 Thread TheSaint
Hi, while testing my program I found some strange happening with pdb and pydb. I like pydb because let me restart the program and nicer features, but if errors pop up, then it will forget all variables (globals and locals gone). I've to go for pdb because it isn't affected by that problem, but al

Re: best way to create a timer/alarm

2008-06-13 Thread Gabriel Genellina
En Fri, 13 Jun 2008 02:42:53 -0300, Alexnb <[EMAIL PROTECTED]> escribió: 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 Tkinte

Checking list by using of exception

2008-06-13 Thread Nader
Hello, I read some files name from a directory and then I put these name in a list. I will check whether it is empty or not, and I would do it with an exception. With if statement it is very simple: If list_of_files != "" :# this can be if list_of_files != []: get the files elas:

Re: Comments on my first script?

2008-06-13 Thread Phillip B Oldham
Thanks guys. Those comments are really helpful. The odd semi-colon is my PHP background. Will probably be a hard habbit to break, that one! ;) If I do accidentally drop a semi-colon at the end of the line, will that cause any weird errors? Also, Chris, can you explain this: a, b = line.split(': ')

Re: ANN: eGenix pyOpenSSL Distribution 0.7.0-0.9.8h-1

2008-06-13 Thread Helmut Jarausch
eGenix Team: M.-A. Lemburg wrote: ANNOUNCING eGenix.com pyOpenSSL Distribution Version 0.7.0-0.9.8h-1 An easy to install and use repackaged distribution

Re: Plotting Graphs + Bestfit lines

2008-06-13 Thread Peter Otten
[EMAIL PROTECTED] wrote: > Tried that out too. No error however, best fit lines still not being > made on the graph. Only the 3 plot lines show up. Sorry, I don't know gnuplot, so I can't help you with any but the obvious (read: Python) errors. Peter -- http://mail.python.org/mailman/listinfo/py

Re: Plotting Graphs using Gnuplot

2008-06-13 Thread Helmut Jarausch
[EMAIL PROTECTED] wrote: Hello. Was trying to create a simple plotting function. Wasnt working however. If i write the same code without putting it inside a function it works. :S. Could some1 tell me the problem? Heres the code: # File name Plotting2 import Gnuplot def plot(original, expected

Re: Comments on my first script?

2008-06-13 Thread Chris
On Jun 13, 9:38 am, Phillip B Oldham <[EMAIL PROTECTED]> wrote: > Thanks guys. Those comments are really helpful. The odd semi-colon is > my PHP background. Will probably be a hard habbit to break, that > one! ;) If I do accidentally drop a semi-colon at the end of the line, > will that cause any w

Re: Comments on my first script?

2008-06-13 Thread Bruno Desthuilliers
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's thoughts/comments on what I've done; improvements I can make, "do

Re: using re module to find

2008-06-13 Thread anton
John Machin lexicon.net> writes: > > On Jun 12, 7:11 pm, anton <[EMAIL PROTECTED]> wrote: > > Hi, > > > > I want to replace all occourences of " by \" in a string. > > > > But I want to leave all occourences of \" as they are. > > > > The following should happen: > > > > this I want " while I

Re: Point Of intersection between two plotted functions

2008-06-13 Thread Mark Westwood
Hi Let your 2 functions be f(x) and g(x). Then you have to solve the equation f(x) = g(x). For some functions it will be easier to determine intervals of the real line where f(x)-g(x) > 0 and where f(x)-g(x) < 0 and to find an interval in which the 2 intersect, which would probably be good enoug

Re: My fight with classes :)

2008-06-13 Thread Bruno Desthuilliers
TheSaint a écrit : On 17:47, giovedì 12 giugno 2008 Bruno Desthuilliers wrote: For multiple functions, use classes. Well... Closures are poor men's objects, or so they say (or is that the other way round ?-). Well, I'd like to know what could be the reason to design a single-call class inste

Re: Plotting Graphs + Bestfit lines

2008-06-13 Thread Peter Otten
[EMAIL PROTECTED] wrote: >> > Still confused though i get the instance part ur trying to tell me. > Tried that out too. No error however, best fit lines still not being > made on the graph. Only the 3 plot lines show up. Gave it another shot. You might want something like from __future__ import

Functionality similar to PHP's SimpleXML?

2008-06-13 Thread Phillip B Oldham
I'm sure I'll soon figure out how to find these things out for myself, but I'd like to get the community's advice on something. I'm going to throw together a quick project over the weekend: a spider. I want to scan a website for certain elements. I come from a PHP background, so normally I'd: -

Re: Comments on my first script?

2008-06-13 Thread Aidan
Chris wrote: On Jun 13, 9:38 am, Phillip B Oldham <[EMAIL PROTECTED]> wrote: Thanks guys. Those comments are really helpful. The odd semi-colon is my PHP background. Will probably be a hard habbit to break, that one! ;) If I do accidentally drop a semi-colon at the end of the line, will that cau

boolian logic

2008-06-13 Thread marc wyburn
HI all, I'm a bit stuck with how to work out boolian logic. I'd like to say if A is not equal to B, C or D: do something. I've tried if not var == A or B or C: and various permutations but can't seem to get my head around it. I'm pretty sure I need to know what is calulated first i.e the not

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

2008-06-13 Thread Gabriel Genellina
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? According to http://bugs.python.org/issue839496 it should have been corrected, but apparen

Re: [egenix-info] Re: ANN: eGenix pyOpenSSL Distribution 0.7.0-0.9.8h-1

2008-06-13 Thread eGenix Team: M.-A. Lemburg
On 2008-06-13 09:39, Helmut Jarausch wrote: eGenix Team: M.-A. Lemburg wrote: ANNOUNCING eGenix.com pyOpenSSL Distribution Version 0.7.0-0.9.8h-1 An easy to insta

RE: boolian logic

2008-06-13 Thread Andreas Tawn
if a != b and a != c and a != d: doStuff() else: doOtherStuff() Cheers, Drea >HI all, I'm a bit stuck with how to work out boolian logic. > >I'd like to say if A is not equal to B, C or D: > do something. > >I've tried > >if not var == A or B or C: >and various permutations bu

Re: Checking list by using of exception

2008-06-13 Thread Gabriel Genellina
En Fri, 13 Jun 2008 04:37:44 -0300, Nader <[EMAIL PROTECTED]> escribió: Hello, I read some files name from a directory and then I put these name in a list. I will check whether it is empty or not, and I would do it with an exception. With if statement it is very simple: If list_of_files != ""

Re: boolian logic

2008-06-13 Thread Aidan
marc wyburn wrote: HI all, I'm a bit stuck with how to work out boolian logic. I'd like to say if A is not equal to B, C or D: do something. I've tried if not var == A or B or C: and various permutations but can't seem to get my head around it. I'm pretty sure I need to know what is calula

Re: boolian logic

2008-06-13 Thread marc wyburn
On 13 Jun, 10:34, Aidan <[EMAIL PROTECTED]> wrote: > marc wyburn wrote: > > HI all, I'm a bit stuck with how to work outboolianlogic. > > > I'd like to say if A is not equal to B, C or D: > >    do something. > > > I've tried > > > if not var == A or B or C: > > and various permutations but can't s

Re: boolian logic

2008-06-13 Thread duncan smith
marc wyburn wrote: HI all, I'm a bit stuck with how to work out boolian logic. I'd like to say if A is not equal to B, C or D: do something. I've tried if not var == A or B or C: and various permutations but can't seem to get my head around it. I'm pretty sure I need to know what is calula

Re: boolian logic

2008-06-13 Thread Gabriel Genellina
En Fri, 13 Jun 2008 06:15:52 -0300, marc wyburn <[EMAIL PROTECTED]> escribió: HI all, I'm a bit stuck with how to work out boolian logic. I'd like to say if A is not equal to B, C or D: do something. I've tried if not var == A or B or C: and various permutations but can't seem to get my

Re: [egenix-info] Re: ANN: eGenix pyOpenSSL Distribution 0.7.0-0.9.8h-1

2008-06-13 Thread M.-A. Lemburg
On 2008-06-13 11:27, eGenix Team: M.-A. Lemburg wrote: On 2008-06-13 09:39, Helmut Jarausch wrote: eGenix Team: M.-A. Lemburg wrote: ANNOUNCING eGenix.com pyOpenSSL Distribution

Re: Checking list by using of exception

2008-06-13 Thread Nader
On Jun 13, 11:34 am, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Fri, 13 Jun 2008 04:37:44 -0300, Nader <[EMAIL PROTECTED]> escribió: > > > Hello, > > > I read some files name from a directory and then I put these name in a > > list. I will check whether it is empty or not, and I would do i

Re: Plotting Graphs + Bestfit lines

2008-06-13 Thread arslanburney
Got the problem solved finally. Missed out theses two lines: plot1 = Gnuplot.PlotItems.Data(original, title="Original") plot2 = Gnuplot.PlotItems.Data(expected, title="Expected") plot3 = Gnuplot.PlotItems.Data(actual, title="Acutal") plot4 = Gnuplot.PlotItems.Func('%f * x+%f'%(bf1[

Re: boolian logic

2008-06-13 Thread Roel Schroeven
marc wyburn schreef: HI all, I'm a bit stuck with how to work out boolian logic. I'd like to say if A is not equal to B, C or D: do something. I've tried if not var == A or B or C: and various permutations but can't seem to get my head around it. I'm pretty sure I need to know what is calu

Re: boolian logic

2008-06-13 Thread cokofreedom
> > if var not in (A, B, C): >do_something() > And this is why I love python. -- http://mail.python.org/mailman/listinfo/python-list

Re: How to set directory in save as combo box

2008-06-13 Thread Tim Golden
Couple of things, Gopal, which you might want to remember when posting to mailing lists etc. One is that it's *much* better (and more considerate) to post in plain text, not in HTML. (You should be able to tell Outlook to use plain text). *Especially* when posting code. And even *more* especiall

Re: Debuggers

2008-06-13 Thread R. Bernstein
TheSaint <[EMAIL PROTECTED]> writes: > Hi, > > while testing my program I found some strange happening with pdb and pydb. > > I like pydb because let me restart the program and nicer features, but if > errors pop up, then it will forget all variables (globals and locals gone). I'm not completely

Re: using re module to find

2008-06-13 Thread John Machin
On Jun 13, 6:23 pm, anton <[EMAIL PROTECTED]> wrote: > John Machin lexicon.net> writes: > > > > > On Jun 12, 7:11 pm, anton <[EMAIL PROTECTED]> wrote: > > > Hi, > > > > I want to replace all occourences of " by \" in a string. > > > > But I want to leave all occourences of \" as they are. > > > >

Re: HTML FORM AND PYTHON

2008-06-13 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: Dear Members of the group, I have a small question, if you can help me to find the answer. I have one function: def add_string(n): print “Print Two strings” print “Print the First String” a1=raw_input(“PRINT THE FIRST STRING”) a2=raw_inpu

Re: Mapping None. Why?

2008-06-13 Thread David C. Ullrich
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 >given as None: If you start with a value x and then apply no function at all to it, what results is x. >Help on built-in function map in module __bui

Re: GIL cpu multi core usage problem

2008-06-13 Thread Pau Freixes
Hi, 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 On Wed, Jun 11, 2008 at 3:52 AM, Gabriel Genellina <[EMAIL PROTECTED]> wrote: > En Mon, 09 Jun 2008 15:26:09 -0

Re: Plotting Graphs + Bestfit lines

2008-06-13 Thread Bas
I am not going to reverse engineer your code, but it looks like your writing your own least-squares fitting algorithm and doing some simple plots. Also, from your many posts last days, it looks like you are a newbie struggling with a python interface to gnuplot. May I suggest that you have a look

Re: Functionality similar to PHP's SimpleXML?

2008-06-13 Thread Stefan Behnel
Phillip B Oldham wrote: > I'm going to throw together a quick project over the weekend: a > spider. I want to scan a website for certain elements. > > I come from a PHP background, so normally I'd: > - throw together a quick REST script to handle http request/responses Use the urllib/urllib2 mod

Re: Comments on my first script?

2008-06-13 Thread D'Arcy J.M. Cain
On Fri, 13 Jun 2008 10:19:38 +0200 Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > Ok, since you asked for it, let's go: Good commentary. One small improvement: > REC_CLEANERS = { > '.net' : clean_net, > '.com' : clean_com, > '.tv' : clean_net, > '.uk' : clean_co_uk, > (et

Re: Summing a 2D list

2008-06-13 Thread Karsten Heymann
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 > 3 2 > 4 3 > 4 3 > 4

Re: Summing a 2D list

2008-06-13 Thread BJörn Lindqvist
On Fri, Jun 13, 2008 at 2:12 PM, Karsten Heymann <[EMAIL PROTECTED]> wrote: > Although your problem has already been solved, I'd like to present a > different approach which can be quite a bit faster. The most common > approach seems to be using a dictionary: > > summed_up={} > for user,vote in pai

Re: Summing a 2D list

2008-06-13 Thread BJörn Lindqvist
On Thu, Jun 12, 2008 at 3:48 PM, Mark <[EMAIL PROTECTED]> wrote: > Hi all, > > I have a scenario where I have a list like this: > > UserScore > 1 0 > 1 1 > 1 5 > 2 3 > 2 1 > 3 2 > 4

TypeError with date class

2008-06-13 Thread Dummy Pythonese Luser
Greetings *.*: The following program caused an error and puzzled me to no end. Any help immensely appreciated. (Thanks)^2 - Yet Another Dummy Python User (Python version: Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit (Intel)] on win32 ) -

Re: Summing a 2D list

2008-06-13 Thread Gerhard Häring
BJörn Lindqvist wrote: [...] Here is another solution: from itertools import groupby from operator import itemgetter users = [1, 1, 1, 2, 2, 3, 4, 4, 4] scores = [0, 1, 5, 3, 1, 2, 3, 3, 2] for u, s in groupby(zip(users, scores), itemgetter(0)): print u, sum(y for x, y in s) Except that

Re: Setting Focus

2008-06-13 Thread Hyuga
On Jun 12, 11:04 pm, Gandalf <[EMAIL PROTECTED]> wrote: > You know these application like ICQ or winamp which stay at the front > of the desktop as long as the user doesn't minimize it. I wont to do > the same with my application in python. > I still didn't manage to make pywinauto to auto set my

Re: Setting Focus

2008-06-13 Thread Hyuga
On Jun 13, 9:34 am, Hyuga <[EMAIL PROTECTED]> wrote: > On Jun 12, 11:04 pm, Gandalf <[EMAIL PROTECTED]> wrote: > > > You know these application like ICQ or winamp which stay at the front > > of the desktop as long as the user doesn't minimize it. I wont to do > > the same with my application in py

pyinotify issue

2008-06-13 Thread AndreH
Good day, I just installed pyinotify on my gentoo box. When I test the library through "pyinotify.pv -v /tmp" under root, everything works great, but when I try the same thing under my local user account, I receive the following error: Error: cannot watch . (WD=-1) Not very helpful. I've tried V

Re: using re module to find " but not " alone ... is this a BUG in re?

2008-06-13 Thread Paul McGuire
On Jun 12, 4:11 am, anton <[EMAIL PROTECTED]> wrote: > Hi, > > I want to replace all occourences of " by \" in a string. > > But I want to leave all occourences of \" as they are. > > The following should happen: > >   this I want " while I dont want this \" > > should be transformed to: > >   this

Re: Setting Focus

2008-06-13 Thread Mike Driscoll
On Jun 12, 10:04 pm, Gandalf <[EMAIL PROTECTED]> wrote: > You know these  application like ICQ or winamp which stay at the front > of the desktop as long as the user doesn't minimize it. I wont to do > the same with my application in python. > I still didn't manage to make pywinauto to auto set my

Create list from string

2008-06-13 Thread ericdaniel
Hi, I'm new to Python and I need to do the following: from this: s = "978654321" to this : ["978", "654", "321"] Any help is appreciated Thanks, Eric -- http://mail.python.org/mailman/listinfo/python-list

Re: Summing a 2D list

2008-06-13 Thread Karsten Heymann
Hi Björn, "BJörn Lindqvist" <[EMAIL PROTECTED]> writes: > On Fri, Jun 13, 2008 at 2:12 PM, Karsten Heymann > <[EMAIL PROTECTED]> wrote: >> summed_up={} >> for user,vote in pairs: >> if summed_up.has_key(user): >>summed_up[user]+=vote >> else: >>summed_up[user]=vote > > You'll save even m

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

2008-06-13 Thread chrispoliquin
Hi, I have a small Python script to fetch some pages from the internet. There are a lot of pages and I am looping through them and then downloading the page using urlretrieve() in the urllib module. The problem is that after 110 pages or so the script sort of hangs and then I get the following tr

Re: Create list from string

2008-06-13 Thread Ben Sizer
On Jun 13, 3:15 pm, ericdaniel <[EMAIL PROTECTED]> wrote: > Hi, > > I'm new to Python and I need to do the following: > > from this:   s = "978654321" > to this :      ["978", "654", "321"] What are your criteria for splitting this string? Every 3 characters? If there isn't an even multiple of 3,

Re: Create list from string

2008-06-13 Thread Chris
On Jun 13, 4:15 pm, ericdaniel <[EMAIL PROTECTED]> wrote: > Hi, > > I'm new to Python and I need to do the following: > > from this:   s = "978654321" > to this :      ["978", "654", "321"] > > Any help is appreciated > > Thanks, > > Eric What you could do is iterate over the string appending the

Re: Create list from string

2008-06-13 Thread Peter Otten
ericdaniel wrote: > I'm new to Python and I need to do the following: > > from this: s = "978654321" > to this : ["978", "654", "321"] Use a loop: >>> s = "978654321" >>> items = [] >>> for start in range(0, len(s), 3): ... items.append(s[start:start+3]) ... >>> items ['978', '654',

pgdb connection string

2008-06-13 Thread Johannes Bauer
Hello group, I've run into a small problem with pgdb which is actually not PostgreSQL specific - I just do not understand the Python syntax at one point. I'm trying to initialize a connection to a PG database. So help(pgdb) says: pgdb.connect(connect_string) -> connection connect_

Re: Create list from string

2008-06-13 Thread John Machin
On Jun 14, 12:15 am, ericdaniel <[EMAIL PROTECTED]> wrote: > Hi, > > I'm new to Python and I need to do the following: > > from this: s = "978654321" > to this : ["978", "654", "321"] > > Any help is appreciated > Homework? Have you read the Python tutorial (section 3.1.2 Strings)? -- http

Re: Create list from string

2008-06-13 Thread ericdaniel
Hi Chris, Thank you very much, that was exactly what I needed. Eric On Jun 13, 9:29 am, Chris <[EMAIL PROTECTED]> wrote: > On Jun 13, 4:15 pm, ericdaniel <[EMAIL PROTECTED]> wrote: > > > Hi, > > > I'm new to Python and I need to do the following: > > > from this:   s = "978654321" > > to this :

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

2008-06-13 Thread Chris
On Jun 13, 4:21 pm, [EMAIL PROTECTED] wrote: > Hi, > > I have a small Python script to fetch some pages from the internet. > There are a lot of pages and I am looping through them and then > downloading the page using urlretrieve() in the urllib module. > > The problem is that after 110 pages or so

Python internals paper or book

2008-06-13 Thread Pau Freixes
Hi list, I'm thinking to spend my last credits* into my Universitiy writing a unofficial and brief python internal paper. I'm crasy love with Python, non only because it's a stupidly easy language, because when I'm programming I have the opportunity to think how is implemented :) My idea is write

Re: Mapping None. Why?

2008-06-13 Thread Paddy
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 > >given as None: > > If you start with a value x and then apply no function > a

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

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

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

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

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

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

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

  1   2   >