Re: [Tutor] Strange list behaviour in classes

2010-02-25 Thread ALAN GAULD
One point: class Statistics: def __init__(self, *value_list): >self.value = value_list >self.square_list= [] >def mean(self, *value_list): >try : >ave = sum(self.value) / len(self.value) >except ZeroDivisionError: >ave = 0 >return ave You don't use value_list here you use self.value. So you don't

Re: [Tutor] Cannot open SQLite database

2010-02-25 Thread Timo
On 25-02-10 00:03, ALAN GAULD wrote: Does the file actually exist where you say it does? It doesn't need to exist, it will be created if it isn't found. Of course I should have known that! It points to the path/folder then... It is on Windows XP, and in the logfile it says it uses the

Re: [Tutor] Cannot open SQLite database

2010-02-25 Thread ALAN GAULD
> > It is on Windows XP, and in the logfile it says it uses the directory: > > C:\Documents and Settings\user\Application Data\myapp > > > > That directory should always be writeable for the user, no? > > > > Not on my PC its Read Only > > > > And I have administrator rights.

Re: [Tutor] Cannot open SQLite database

2010-02-25 Thread Timo
2010/2/25 ALAN GAULD > > > What should be the correct folder then? > > I don't know! To be honest I was surprised by the result too. > Personally I tend to either use the application folder or the registry. > But the app folder doesn't work for user specific settings unless > you have a separate

Re: [Tutor] Omitting lines matching a list of strings from a file

2010-02-25 Thread Alan Gauld
wrote I am trying to output a list of addresses that do not match a list of State abbreviations. What I have so far is: def main(): infile = open("list.txt", "r") for line in infile: state = line[146:148] omit_states = ['KS', 'KY', 'MA', 'ND', 'NE', 'NJ', 'PR', 'R

Re: [Tutor] Strange list behaviour in classes

2010-02-25 Thread Dave Angel
James Reynolds wrote: Thank you! I think I have working in the right direction. I have one more question related to this module. I had to move everything to a single module, but what I would like to do is have this class in a file by itself so I can call this from other modules. when it was in s

Re: [Tutor] Strange list behaviour in classes

2010-02-25 Thread Walter Prins
On 25 February 2010 11:22, Dave Angel wrote: > The indentation in your code is lost when I look for it -- everything's > butted up against the left margin except for a single space before def > variance. This makes it very hard to follow, so I've ignored the thread > till now. This may be caus

[Tutor] [Installing Spyder IDE]:Help

2010-02-25 Thread vanam
I have been trying to install spyder ide but of no avail. Downloaded and installed spyder-1.03_py26.exe I have downloaded pyqt4 for that purpose(Direct Installer) pyqt-py2.6-gpl-4.7-1.exe after installing the above softwares and then launching Spyder it is showing initialising and gets disappears.

Re: [Tutor] Omitting lines matching a list of strings from a file

2010-02-25 Thread galaxywatcher
But I would do this with a list comprehension or generator expression (depending on your Python version): lines = [line for line in infile if line[146:148] not in omit_states] print '\n'.join(lines) That's very helpful. Thanks. One formatting detail: there is a blank line after each line pri

Re: [Tutor] Omitting lines matching a list of strings from a file

2010-02-25 Thread Christian Witts
galaxywatc...@gmail.com wrote: But I would do this with a list comprehension or generator expression (depending on your Python version): lines = [line for line in infile if line[146:148] not in omit_states] print '\n'.join(lines) That's very helpful. Thanks. One formatting detail: there is a

Re: [Tutor] Strange list behaviour in classes

2010-02-25 Thread Ken Oliver
-Original Message- From: Walter Prins Sent: Feb 25, 2010 7:09 AM To: Dave Angel Cc: Alan Gauld , tutor@python.org Subject: Re: [Tutor] Strange list behaviour in classes On 25 February 2010 11:22, Dave Angel wrote: The indentation in your code is lost when I look for i

Re: [Tutor] Cannot open SQLite database

2010-02-25 Thread Michael M Mason
ALAN GAULD wrote on 25 February 2010 at 08:50:- > So I think that was a red herring, sorry. > It also looks like the Read Only check box in the main > Explorer property dialog tab doesn't mean what it says... Doesn't the Read Only checkbox have a coloured square rather than a tick? AFAIK the col

Re: [Tutor] Cannot open SQLite database

2010-02-25 Thread Tim Golden
On 25/02/2010 15:18, Michael M Mason wrote: ALAN GAULD wrote on 25 February 2010 at 08:50:- So I think that was a red herring, sorry. It also looks like the Read Only check box in the main Explorer property dialog tab doesn't mean what it says... Doesn't the Read Only checkbox have a coloured

[Tutor] raising number to a power

2010-02-25 Thread Monte Milanuk
Is there a benefit (besides brevity) one way or the other between using: import math ... math.pow(x,y) # x raised to the power y vs. x**y ? Thanks, Monte ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://

Re: [Tutor] raising number to a power

2010-02-25 Thread Stefan Behnel
Monte Milanuk, 25.02.2010 16:47: > Is there a benefit (besides brevity) one way or the other between using: > > import math > ... > math.pow(x,y) # x raised to the power y > > vs. > > x**y > > ? Did you try it? >>> import math >>> print(math.pow(4,4)) 256.0 >>> 4**4 256

Re: [Tutor] raising number to a power

2010-02-25 Thread Stefan Behnel
Monte Milanuk, 25.02.2010 16:47: > Is there a benefit (besides brevity) one way or the other between using: > > import math > ... > math.pow(x,y) # x raised to the power y > > vs. > > x**y > > ? You might also be interested in this: http://docs.python.org/reference/datamodel.html#emulating-n

Re: [Tutor] raising number to a power

2010-02-25 Thread Steven D'Aprano
On Fri, 26 Feb 2010 05:34:39 am Ricardo Aráoz wrote: > So why would the coders of the math module go to the trouble of > creating the pow function? http://docs.python.org/library/math.html#math.pow http://docs.python.org/library/functions.html#pow The math module is mostly a thin wrapper around

Re: [Tutor] raising number to a power

2010-02-25 Thread Wayne Werner
2010/2/25 Ricardo Aráoz > Stefan Behnel wrote: > So why would the coders of the math module go to the trouble of creating > the pow function? Did they create a sum function and a subtract function? > It seems to me the question has not been properly answered. When to use > one, when to use the o

Re: [Tutor] raising number to a power

2010-02-25 Thread Ricardo Aráoz
Stefan Behnel wrote: > Monte Milanuk, 25.02.2010 16:47: > >> Is there a benefit (besides brevity) one way or the other between using: >> >> import math >> ... >> math.pow(x,y) # x raised to the power y >> >> vs. >> >> x**y >> >> ? >> > > You might also be interested in this: > > http://doc

Re: [Tutor] raising number to a power

2010-02-25 Thread Steven D'Aprano
On Fri, 26 Feb 2010 04:27:06 am Monte Milanuk wrote: > So... pow(4,4) is equivalent to 4**4, which works on anything - > integers, floats, etc., but math.pow(4,4) only works on floats... and > in this case it converts or interprets (4,4) as (4.0,4.0), hence > returning a float: 256.0. Is that about

Re: [Tutor] raising number to a power

2010-02-25 Thread Ricardo Aráoz
Stefan Behnel wrote: > Monte Milanuk, 25.02.2010 16:47: > >> Is there a benefit (besides brevity) one way or the other between using: >> >> import math >> ... >> math.pow(x,y) # x raised to the power y >> >> vs. >> >> x**y >> >> ? >> > > Did you try it? > > >>> import math > >>> pr

Re: [Tutor] raising number to a power

2010-02-25 Thread salaiman alrayes
i'm not an expert, but i have worked with "import math". i believe if you use import math; it will make you capable of using all kinds of math in python (sin,cos,sin^-1..) i recommend you google "python math" or "python import math", and that will take you to the library reference. its he

Re: [Tutor] raising number to a power

2010-02-25 Thread Stefan Behnel
Monte Milanuk, 25.02.2010 18:27: > So... pow(4,4) is equivalent to 4**4, which works on anything - integers, > floats, etc. Correct, e.g. >>> class Test(object): ... def __pow__(self, other, modulo=None): ... print("POW!") ... return 'tutu' ... >>> pow(Test(), 4) POW!

Re: [Tutor] test

2010-02-25 Thread vince spicer
On Thu, Feb 25, 2010 at 4:03 PM, Kirk Bailey wrote: > test > -- > > > Cheers! > -Kirk D Bailey > > THINK > +-+ > .*.| BOX | > ..*+-+ > *** THINK > ___ > Tutor maillist - Tutor@python.

Re: [Tutor] Omitting lines matching a list of strings from a file

2010-02-25 Thread Alan Gauld
"Christian Witts" wrote lines = [line for line in infile if line[146:148] not in omit_states] print ''.join(lines) Just remember that doing a list comprehension like that on a large file will drastically reduce the speed of your application as well as introduce memory bloat. Given he was

[Tutor] test

2010-02-25 Thread Kirk Bailey
test -- Cheers! -Kirk D Bailey THINK +-+ .*.| BOX | ..*+-+ *** THINK ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.o

[Tutor] test again

2010-02-25 Thread Kirk Bailey
test- where is the list, nothing is coming to me! -- Cheers! -Kirk D Bailey THINK +-+ .*.| BOX | ..*+-+ *** THINK ___ Tutor maillist - Tutor@python.org To unsubscribe or cha

[Tutor] wHY

2010-02-25 Thread Kirk Bailey
IS NOTHING FROM THE LIST COMING TO ME? -- Cheers! -Kirk D Bailey THINK +-+ .*.| BOX | ..*+-+ *** THINK ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscri

Re: [Tutor] test again

2010-02-25 Thread Kirk Bailey
ook, thi new thunderbird 3.foo is... different, takes some getting used to. Sorry about the noise on the channel. On 2/25/2010 5:31 PM, Kirk Bailey wrote: test- where is the list, nothing is coming to me! -- Cheers! -Kirk D Bailey THINK +-+ .*.

Re: [Tutor] wHY

2010-02-25 Thread Luke Paireepinart
YOU DON'T GET YOUR OWN MESSAGES BACK. On Thu, Feb 25, 2010 at 5:11 PM, Kirk Bailey wrote: > IS NOTHING FROM THE LIST COMING TO ME? > > -- > > > Cheers! > -Kirk D Bailey > > THINK > +-+ > .*.| BOX | > ..*+-+ > *** THINK > ___

Re: [Tutor] wHY

2010-02-25 Thread Antonio de la Fuente
Definitely there is somebody out there :) * Kirk Bailey [2010-02-25 18:11:57 -0500]: > Date: Thu, 25 Feb 2010 18:11:57 -0500 > From: Kirk Bailey > To: tutor@python.org > Subject: [Tutor] wHY > Organization: Silas Dent Memorial Cabal of ERIS Esoteric and hot dog > boiling > society FNORD!

Re: [Tutor] wHY

2010-02-25 Thread Alan Gauld
"Kirk Bailey" wrote IS NOTHING FROM THE LIST COMING TO ME? Stating the obvious first - have you checked your subscription settings? Have you got delivery switched on? Have you tried switching it off then on again just to be sure? Alan G. ___

[Tutor] returning to my quest

2010-02-25 Thread Kirk Bailey
for WEBMAIIL portal to a pop3/smtp email service in my server; centrally hosted or in the laptop is fine, what can people recommend? Without going to IMAP, i want to leave the mail on the server. -- Cheers! -Kirk D Bailey THINK +-+ .*.| BOX

[Tutor] Top posters for 2009

2010-02-25 Thread Kent Johnson
It's not really about keeping score :-), but once again I've compiled a list of the top 20 posters to the tutor list for the last year. For 2009, the rankings are 2009 (7730 posts, 709 posters) Alan Gauld 969 (12.5%) Kent Johnson 804 (10.4%) Dave Angel 254 (3.3%) spir 254 (3.3%) Wayne Watson

Re: [Tutor] returning to my quest

2010-02-25 Thread Kent Johnson
On Thu, Feb 25, 2010 at 8:59 PM, Kirk Bailey wrote: > for  WEBMAIIL portal to a pop3/smtp email service in my server; centrally > hosted or in the laptop is fine, what can people recommend? Without going to > IMAP, i want to leave the mail on the server. I still have no idea what you are asking f

Re: [Tutor] Top posters for 2009

2010-02-25 Thread Shashwat Anand
nice. Kudos to all top posters. May be I should search my rank ;) ~l0nwlf On Fri, Feb 26, 2010 at 8:23 AM, Kent Johnson wrote: > It's not really about keeping score :-), but once again I've compiled > a list of the top 20 posters to the tutor list for the last year. For > 2009, the rankings are

Re: [Tutor] Top posters for 2009

2010-02-25 Thread Shashwat Anand
How about Top-40 posters (so that I can make the cut..Yayyy) :P 2009 (7730 posts, 709 posters) Alan Gauld 969 (12.5%) Kent Johnson 804 (10.4%) Dave Angel 254 (3.3%) spir 254 (3.3%) Wayne Watson 222 (2.9%) bob gailer 191 (2.5%) Lie Ryan 186 (2.4%) David 127 (1.6%) Emile van Sebille 115 (1.5%)

Re: [Tutor] Top posters for 2009

2010-02-25 Thread Shashwat Anand
@Kent: thanks for the script. It is kool. Here is 2010 list of Top-20 (as of now): 2010 (1155 posts, 204 posters) Alan Gauld 127 (11.0%) Kent Johnson 108 (9.4%) spir 52 (4.5%) Wayne Watson 46 (4.0%) Luke Paireepinart 32 (2.8%) Shashwat Anand 30 (2.6%) Wayne Werner 29 (2.5%) Steven D'Aprano 2

Re: [Tutor] returning to my quest

2010-02-25 Thread Benno Lang
On 26 February 2010 11:55, Kent Johnson wrote: > On Thu, Feb 25, 2010 at 8:59 PM, Kirk Bailey wrote: >> for  WEBMAIIL portal to a pop3/smtp email service in my server; centrally >> hosted or in the laptop is fine, what can people recommend? Without going to >> IMAP, i want to leave the mail on th

[Tutor] PyAutoRun

2010-02-25 Thread Zubin Mithra
I have been using python for quite some time; however this is the first python project i have worked on. The code is hosted at http://github.com/zubin71/PyAutoRun The code needs re-factoring and feature additions; i have put up a TODO list there too. It`d be great if anyone could work on this; i