Re: [Tutor] Strange list behaviour in classes
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 need value_list def median(self, *value_list): >if len(self.value) <= 2: >n = self.mean(self.value) >elif len(self.value) % 2 == 1: >m = (len(self.value) - 1)/2 >n = self.value[m+1] >else: >m = len(self.value) / 2 >m = int(m) >n = (self.value[m-1] + self.value[m]) / 2 >return n Same here... def variance(self, *value_list): >average = self.mean(*self.value) >for n in range(len(self.value)): >square = (self.value[n] - average)**2 >self.square_list.append(square) >try: >var = sum(self.square_list) / len(self.square_list) >except ZeroDivisionError: >var = 0 >return var And here... def stdev(self, *value_list): >var = self.variance(*self.value) >sdev = var**(1/2) >return sdev And here... def zscore(self, x, *value_list): >average = self.mean(self.value) >sdev = self.stdev(self.value) >try: >z = (x - average) / sdev >except ZeroDivisionError: >z = 0 >return z And here a = [1,2,3,4,5,6,7,8,9,10] >stats = Statistics(*a) >So you need the *a here mean = stats.mean(*a) >median = stats.median(*a) >var = stats.variance(*a) >stdev = stats.stdev(*a) >z = stats.zscore(5, *a) >But you don't need to pass in *a in any of these calls. Its already stored in the object. Also instead of returning these values (or as well as) you could have stored them as variables inside the object. print(mean, median, var, stdev, z) > >In which case this would become print(self.theMean,self.theMedian, etc...) Just an alternative for consideration. Alan G.___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Cannot open SQLite database
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 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. A normal user is even more likely to be limited. And a Guest account definitely would be. Hmm that's strange. I thought the application data folder is the correct folder on Windows systems to put your configuration files. And until now, it worked perfectly for every user. What should be the correct folder then? Cheers, Timo HTH, Alan G. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Cannot open SQLite database
> > 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. > > A normal user is even more likely to be limited. > > And a Guest account definitely would be. > Hmm that's strange. I thought the application data folder is the correct > folder on Windows systems to put your configuration files. And until > now, it worked perfectly for every user. > > 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 file based on user ID. Its very odd. In fact Windows explorer appears to be lying. I just tried creating a file using Python and it worked perfectly. But Explorer definitely claims its R/Only! I also tried the ATTRIB command from DOS and it does not show it as Read only. Cygwin shows it as readonly for world access but open for user and group. The security tab in exporer shows it read/write for admins and me. (It doesn't show a world setting) 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... Alan G. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Cannot open SQLite database
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 file based on user ID. > > Its very odd. > > In fact Windows explorer appears to be lying. I just tried creating > a file using Python and it worked perfectly. But Explorer definitely > claims its R/Only! I also tried the ATTRIB command from DOS > and it does not show it as Read only. > > Cygwin shows it as readonly for world access but open for user > and group. The security tab in exporer shows it read/write for > admins and me. (It doesn't show a world setting) > > 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... > > Alan G. > I just thought of something, and it can't be that the folder isn't writeable. Because I asked the user for the logfile that my program produces, and it is located in the same folder as where the database should be. So if the folder wasn't writeable, the creation of the logfile would have caused an error too. So I'm a bit stuck about this one. Timo ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Omitting lines matching a list of strings from a file
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', 'RI', 'SD', 'VI', 'VT', 'WI'] for n in omit_states: if state != n: print line This prints it for every entry in omit_states. You probably want to add a break command after the print 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) HTH, -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Strange list behaviour in classes
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 separate modules it ran with all 0's in the output. Here is the code in one module: #import Statistics 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 def median(self, *value_list): if len(self.value) <= 2: n = self.mean(self.value) elif len(self.value) % 2 == 1: m = (len(self.value) - 1)/2 n = self.value[m+1] else: m = len(self.value) / 2 m = int(m) n = (self.value[m-1] + self.value[m]) / 2 return n def variance(self, *value_list): average = self.mean(*self.value) for n in range(len(self.value)): square = (self.value[n] - average)**2 self.square_list.append(square) try: var = sum(self.square_list) / len(self.square_list) except ZeroDivisionError: var = 0 return var def stdev(self, *value_list): var = self.variance(*self.value) sdev = var**(1/2) return sdev def zscore(self, x, *value_list): average = self.mean(self.value) sdev = self.stdev(self.value) try: z = (x - average) / sdev except ZeroDivisionError: z = 0 return z a = [1,2,3,4,5,6,7,8,9,10] stats = Statistics(*a) mean = stats.mean(*a) median = stats.median(*a) var = stats.variance(*a) stdev = stats.stdev(*a) z = stats.zscore(5, *a) print(mean, median, var, stdev, z) print() On Wed, Feb 24, 2010 at 7:33 PM, Alan Gauld wrote: "James Reynolds" wrote I understand, but if self.value is any number other then 0, then the "for" will append to the square list, in which case square_list will always have some len greater than 0 when "value" is greater than 0? And if value does equal zero? Actually I'm confused by value because you treat it as both an integer and a collection in different places? Is this an occasion which is best suited for a try:, except statement? Or should it, in general, but checked with "if's". Which is more expensive? try/except is the Python way :-) def variance(self, *value_list): if self.value == 0: var = 0 else: average = self.mean(*self.value) for n in range(len(self.value)): square = (self.value[n] - average)**2 self.square_list.append(square) var = sum(self.square_list) / len(self.square_list) return var -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ 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 caused by the mail digest logic, or it may because you're posting online, and don't tell it to leave the code portion unformatted. But either way, you should find a way to leave the code indented as Python would see it. If you're posting by mail, be sure and send it as text. But a few things I notice in your code: You keep using the * notation on your formal parameters. That's what turns a list into a tuple. And you pass those lists into methods (like median()) which already have access to the data in the object, which is very confusing. If the caller actually passes something different there, he's going to be misled, since the argument is ignored. Also, in method variance() you append to the self.square_list. So if it gets called more than once, the list will continue to grow. Since square_list is only referenced within the one method, why not just define it there, and remove it as a instance attribute? If I were you, I'd remove the asterisk from both the __init__() method parameter, and from the caller in top-level code. You're building a list, and passing it. Why mess with turning it into multiple arguments, and then back to a tuple? Then I'd remove the spurious arguments to mean(), variance(), stdev() and zscore(). There are a few other things, but this should make it cleaner. DaveA ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
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 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 caused by the mail digest logic, or it may because > you're posting online, and don't tell it to leave the code portion > unformatted. This is probably something your end, I read and post from within Google mail (as well as from Thunderbird occassionally) and I have no trouble seeing the indentation. (I don't use the mail digest, I receive single emails/posts.) ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] [Installing Spyder IDE]:Help
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. Is that something or dependency i have missed to install? -- Raghavendra Vanam -- Raghavendra Vanam ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Omitting lines matching a list of strings from a file
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 printed, how do I ged rid of the extra blank lines? ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Omitting lines matching a list of strings from a file
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 blank line after each line printed, how do I ged rid of the extra blank lines? ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor lines = [line.strip() for line in infile if line[146:148] not in omit_states] print '\n'.join(lines) or alternatively 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. -- Kind Regards, Christian Witts ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Strange list behaviour in classes
-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 Angelwrote: 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 caused by the mail digest logic, or it may because you're posting online, and don't tell it to leave the code portion unformatted. This is probably something your end, I read and post from within Google mail (as well as from Thunderbird occassionally) and I have no trouble seeing the indentation. (I don't use the mail digest, I receive single emails/posts.)=== I am also seeing the same unindented code. . ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Cannot open SQLite database
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 coloured square is intended to mean "doesn't apply", and you should see the same thing on all folders. You can tick the checkbox and click the "Apply" button to make all the files in the folder Read-Only in one easy move. It doesn't make the folder Read-Only, and if you close and re-open the Properties dialog after ticking the checkbox you'll find the coloured square will reappear. -- Michael ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Cannot open SQLite database
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 square rather than a tick? AFAIK the coloured square is intended to mean "doesn't apply", and you should see the same thing on all folders. You can tick the checkbox and click the "Apply" button to make all the files in the folder Read-Only in one easy move. It doesn't make the folder Read-Only, and if you close and re-open the Properties dialog after ticking the checkbox you'll find the coloured square will reappear. Haven't been following this thread, but just picking up on this: the read-only attribute on folders means: this is a special folder (eg My Documents). There's no way to make a directory read-only like this... TJG ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] raising number to a power
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://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] raising number to a power
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 >>> 4.0**4 256.0 Stefan ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] raising number to a power
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-numeric-types The difference is that math.pow() is a function that works on two float values, whereas '**' is an operator that can work on anything, including your own classes. It's the number types that define the operator as meaning the power function, not the operator itself. Stefan ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] raising number to a power
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 the native C maths library. The builtin pow function has more capabilities, and came before the ** operator. > Did they create a sum function As a matter of fact they did: http://docs.python.org/library/math.html#math.fsum -- Steven D'Aprano ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] raising number to a power
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 other? > If you don't know the answer it's all right. I don't know it either. > Only a theory: Perhaps for familiarities sake - many other languages (and all of them that I know with a math library) have something like, if not, math.pow(base, exp), so it could be they wanted to allow that similarity... or it could just be from way back in the early days of Python? just my thoughts on the subject, Wayne ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] raising number to a power
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://docs.python.org/reference/datamodel.html#emulating-numeric-types > > The difference is that math.pow() is a function that works on two float > values, whereas '**' is an operator that can work on anything, including > your own classes. It's the number types that define the operator as meaning > the power function, not the operator itself. > 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 other? If you don't know the answer it's all right. I don't know it either. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] raising number to a power
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 right? Pretty much, but the builtin pow also takes an optional third argument: >>> pow(4, 4, 65) # same as 4**4 % 65 only more efficient 61 By the way, are you aware that you can get help in the interactive interpreter? help(pow) -- Steven D'Aprano ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] raising number to a power
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 > >>> print(math.pow(4,4)) > 256.0 > >>> 4**4 > 256 > >>> 4.0**4 > 256.0 > > Stefan > Yes, I tried it. Now, is there a benefit (besides brevity) one way or the other? ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] raising number to a power
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 helpful. On Feb 25, 2010, at 1:35 PM, Ricardo Aráoz wrote: 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 >>> print(math.pow(4,4)) 256.0 >>> 4**4 256 >>> 4.0**4 256.0 Stefan Yes, I tried it. Now, is there a benefit (besides brevity) one way or the other? ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] raising number to a power
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! 'tutu' >>> Test() ** 4 POW! 'tutu' But: >>> pow(Test(), 4, 5) POW! 'tutu' The pow() function has a 3-argument form that efficiently calculates the modulo. There is no operator for that, and, IMHO, that's the raison d'être for the pow() function in the first place. > 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 right? Yes. Read the docs: """ 10.2. math — Mathematical functions This module is always available. It provides access to the mathematical functions defined by the C standard. [...] The following functions are provided by this module. Except when explicitly noted otherwise, all return values are floats. """ http://docs.python.org/library/math.html So these are purely numeric and therefore actually pretty fast functions, which is /their/ raison d'être. $ python3.1 -m timeit -s 'from math import pow as mpow' 'pow(2,2)' 100 loops, best of 3: 0.562 usec per loop $ python3.1 -m timeit -s 'from math import pow as mpow' 'mpow(2,2)' 1000 loops, best of 3: 0.18 usec per loop However: $ python3.1 -m timeit -s 'from math import pow as mpow' '2**2' 1000 loops, best of 3: 0.0247 usec per loop Stefan ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] test
On Thu, Feb 25, 2010 at 4:03 PM, Kirk Bailey wrote: > test > -- > > > Cheers! > -Kirk D Bailey > > THINK > +-+ > .*.| BOX | > ..*+-+ > *** THINK > ___ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > http://mail.python.org/mailman/listinfo/tutor > Hello World! << usually a good test ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Omitting lines matching a list of strings from a file
"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 originally doing an explicit for loop over the file I doubt if the comprehension will be any slower. But it may well use more memory. Alan G. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] test
test -- Cheers! -Kirk D Bailey THINK +-+ .*.| BOX | ..*+-+ *** THINK ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] test again
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 change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] wHY
IS NOTHING FROM THE LIST COMING TO ME? -- Cheers! -Kirk D Bailey THINK +-+ .*.| BOX | ..*+-+ *** THINK ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] test again
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 +-+ .*.| BOX | ..*+-+ *** THINK ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] wHY
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 > ___ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > http://mail.python.org/mailman/listinfo/tutor > ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] wHY
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! > User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; > rv:1.9.1.8) Gecko/20100216 Thunderbird/3.0.2 > Message-ID: <4b8703bd.8010...@howlermonkey.net> > > IS NOTHING FROM THE LIST COMING TO ME? > > -- > > > Cheers! > -Kirk D Bailey > > THINK > +-+ > .*.| BOX | > ..*+-+ > *** THINK > ___ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > http://mail.python.org/mailman/listinfo/tutor -- - Antonio de la Fuente Martínez E-mail: t...@muybien.org - Classical music is the kind we keep thinking will turn into a tune. -- Kin Hubbard, "Abe Martin's Sayings" ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] wHY
"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 maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] returning to my quest
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 | ..*+-+ *** THINK ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] Top posters for 2009
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 222 (2.9%) bob gailer 191 (2.5%) Lie Ryan 186 (2.4%) David 127 (1.6%) Emile van Sebille 115 (1.5%) Wayne 112 (1.4%) Sander Sweers 111 (1.4%) Serdar Tumgoren 100 (1.3%) Luke Paireepinart 99 (1.3%) wesley chun 99 (1.3%) W W 74 (1.0%) Marc Tompkins 72 (0.9%) A.T.Hofkamp 71 (0.9%) Robert Berman 68 (0.9%) vince spicer 63 (0.8%) Emad Nawfal 62 (0.8%) Alan, congratulations, you pulled ahead of me for the first time in years! You posted more than in 2008, I posted less. Overall posts are up from last year, which was the slowest year since I started measuring (2003). Thank you to everyone who asks and answers questions here! The rankings are compiled by scraping the monthly author pages from the tutor archives, using Beautiful Soup to extract author names. I consolidate counts for different capitalizations of the same name but not for different spellings. The script is below. Kent ''' Counts all posts to Python-tutor by author''' # -*- coding: latin-1 -*- from datetime import date, timedelta import operator, urllib2 from BeautifulSoup import BeautifulSoup today = date.today() for year in range(2009, 2010): startDate = date(year, 1, 1) endDate = date(year, 12, 31) thirtyOne = timedelta(days=31) counts = {} # Collect all the counts for a year by scraping the monthly author archive pages while startDate < endDate and startDate < today: dateString = startDate.strftime('%Y-%B') url = 'http://mail.python.org/pipermail/tutor/%s/author.html' % dateString data = urllib2.urlopen(url).read() soup = BeautifulSoup(data) li = soup.findAll('li')[2:-2] for l in li: name = l.i.string.strip() counts[name] = counts.get(name, 0) + 1 startDate += thirtyOne # Consolidate names that vary by case under the most popular spelling nameMap = dict() # Map lower-case name to most popular name # Use counts.items() so we can delete from the dict. for name, count in sorted(counts.items(), key=operator.itemgetter(1), reverse=True): lower = name.lower() if lower in nameMap: # Add counts for a name we have seen already and remove the duplicate counts[nameMap[lower]] += count del counts[name] else: nameMap[lower] = name totalPosts = sum(counts.itervalues()) posters = len(counts) print print '%s (%s posts, %s posters)' % (year, totalPosts, posters) print '' for name, count in sorted(counts.iteritems(), key=operator.itemgetter(1), reverse=True)[:20]: pct = round(100.0*count/totalPosts, 1) print '%s %s (%s%%)' % (name.encode('utf-8', 'xmlcharrefreplace'), count, pct) print ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] returning to my quest
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 for. What is a WEBMAIL portal? Are you trying to access mail that has a web interface, or create a web interface for an existing POP mailbox, or what? Oh, and what does this have to do with Python? Kent ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Top posters for 2009
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 > > 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%) > Wayne 112 (1.4%) > Sander Sweers 111 (1.4%) > Serdar Tumgoren 100 (1.3%) > Luke Paireepinart 99 (1.3%) > wesley chun 99 (1.3%) > W W 74 (1.0%) > Marc Tompkins 72 (0.9%) > A.T.Hofkamp 71 (0.9%) > Robert Berman 68 (0.9%) > vince spicer 63 (0.8%) > Emad Nawfal 62 (0.8%) > > Alan, congratulations, you pulled ahead of me for the first time in > years! You posted more than in 2008, I posted less. Overall posts are > up from last year, which was the slowest year since I started > measuring (2003). > > Thank you to everyone who asks and answers questions here! > > The rankings are compiled by scraping the monthly author pages from > the tutor archives, using Beautiful Soup to extract author names. I > consolidate counts for different capitalizations of the same name but > not for different spellings. The script is below. > > Kent > > ''' Counts all posts to Python-tutor by author''' > # -*- coding: latin-1 -*- > from datetime import date, timedelta > import operator, urllib2 > from BeautifulSoup import BeautifulSoup > > today = date.today() > > for year in range(2009, 2010): >startDate = date(year, 1, 1) >endDate = date(year, 12, 31) >thirtyOne = timedelta(days=31) >counts = {} > ># Collect all the counts for a year by scraping the monthly author > archive pages >while startDate < endDate and startDate < today: >dateString = startDate.strftime('%Y-%B') > >url = 'http://mail.python.org/pipermail/tutor/%s/author.html' > % dateString >data = urllib2.urlopen(url).read() >soup = BeautifulSoup(data) > >li = soup.findAll('li')[2:-2] > >for l in li: >name = l.i.string.strip() >counts[name] = counts.get(name, 0) + 1 > >startDate += thirtyOne > ># Consolidate names that vary by case under the most popular spelling >nameMap = dict() # Map lower-case name to most popular name > ># Use counts.items() so we can delete from the dict. >for name, count in sorted(counts.items(), > key=operator.itemgetter(1), reverse=True): > lower = name.lower() > if lower in nameMap: > # Add counts for a name we have seen already and remove the > duplicate > counts[nameMap[lower]] += count > del counts[name] > else: > nameMap[lower] = name > >totalPosts = sum(counts.itervalues()) >posters = len(counts) > >print >print '%s (%s posts, %s posters)' % (year, totalPosts, posters) >print '' >for name, count in sorted(counts.iteritems(), > key=operator.itemgetter(1), reverse=True)[:20]: >pct = round(100.0*count/totalPosts, 1) >print '%s %s (%s%%)' % (name.encode('utf-8', > 'xmlcharrefreplace'), count, pct) >print > ___ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > http://mail.python.org/mailman/listinfo/tutor > ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Top posters for 2009
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%) Wayne 112 (1.4%) Sander Sweers 111 (1.4%) Serdar Tumgoren 100 (1.3%) Luke Paireepinart 99 (1.3%) wesley chun 99 (1.3%) W W 74 (1.0%) Marc Tompkins 72 (0.9%) A.T.Hofkamp 71 (0.9%) Robert Berman 68 (0.9%) vince spicer 63 (0.8%) Emad Nawfal 62 (0.8%) Andre Engels 61 (0.8%) Rich Lovely 60 (0.8%) Christian Witts 57 (0.7%) Martin Walsh 51 (0.7%) Eduardo Vieira 47 (0.6%) Tim Golden 47 (0.6%) prasad rao 47 (0.6%) Dinesh B Vadhia 47 (0.6%) John Fouhy 42 (0.5%) Norman Khine 41 (0.5%) Che M 41 (0.5%) Stephen Nelson-Smith 40 (0.5%) Mark Tolonen 40 (0.5%) Chris Fuller 38 (0.5%) Stefan Behnel 35 (0.5%) Wayne Werner 34 (0.4%) Steve Willoughby 32 (0.4%) Shashwat Anand 32 (0.4%) Eike Welk 31 (0.4%) Albert-Jan Roskam 30 (0.4%) ~l0nwlf On Fri, Feb 26, 2010 at 9:04 AM, Shashwat Anand wrote: > 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 >> >> 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%) >> Wayne 112 (1.4%) >> Sander Sweers 111 (1.4%) >> Serdar Tumgoren 100 (1.3%) >> Luke Paireepinart 99 (1.3%) >> wesley chun 99 (1.3%) >> W W 74 (1.0%) >> Marc Tompkins 72 (0.9%) >> A.T.Hofkamp 71 (0.9%) >> Robert Berman 68 (0.9%) >> vince spicer 63 (0.8%) >> Emad Nawfal 62 (0.8%) >> >> Alan, congratulations, you pulled ahead of me for the first time in >> years! You posted more than in 2008, I posted less. Overall posts are >> up from last year, which was the slowest year since I started >> measuring (2003). >> >> Thank you to everyone who asks and answers questions here! >> >> The rankings are compiled by scraping the monthly author pages from >> the tutor archives, using Beautiful Soup to extract author names. I >> consolidate counts for different capitalizations of the same name but >> not for different spellings. The script is below. >> >> Kent >> >> ''' Counts all posts to Python-tutor by author''' >> # -*- coding: latin-1 -*- >> from datetime import date, timedelta >> import operator, urllib2 >> from BeautifulSoup import BeautifulSoup >> >> today = date.today() >> >> for year in range(2009, 2010): >>startDate = date(year, 1, 1) >>endDate = date(year, 12, 31) >>thirtyOne = timedelta(days=31) >>counts = {} >> >># Collect all the counts for a year by scraping the monthly author >> archive pages >>while startDate < endDate and startDate < today: >>dateString = startDate.strftime('%Y-%B') >> >>url = 'http://mail.python.org/pipermail/tutor/%s/author.html' >> % dateString >>data = urllib2.urlopen(url).read() >>soup = BeautifulSoup(data) >> >>li = soup.findAll('li')[2:-2] >> >>for l in li: >>name = l.i.string.strip() >>counts[name] = counts.get(name, 0) + 1 >> >>startDate += thirtyOne >> >># Consolidate names that vary by case under the most popular spelling >>nameMap = dict() # Map lower-case name to most popular name >> >># Use counts.items() so we can delete from the dict. >>for name, count in sorted(counts.items(), >> key=operator.itemgetter(1), reverse=True): >> lower = name.lower() >> if lower in nameMap: >> # Add counts for a name we have seen already and remove the >> duplicate >> counts[nameMap[lower]] += count >> del counts[name] >> else: >> nameMap[lower] = name >> >>totalPosts = sum(counts.itervalues()) >>posters = len(counts) >> >>print >>print '%s (%s posts, %s posters)' % (year, totalPosts, posters) >>print '' >>for name, count in sorted(counts.iteritems(), >> key=operator.itemgetter(1), reverse=True)[:20]: >>pct = round(100.0*count/totalPosts, 1) >>print '%s %s (%s%%)' % (name.encode('utf-8', >> 'xmlcharrefreplace'), count, pct) >>print >> ___ >> Tutor maillist - Tutor@python.org >> To unsubscribe or change subscription options: >> http://mail.python.org/mailman/listinfo/tutor >> > > ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Top posters for 2009
@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 28 (2.4%) Stefan Behnel 24 (2.1%) Dave Angel 22 (1.9%) Lie Ryan 19 (1.6%) Hugo Arts 16 (1.4%) Benno Lang 14 (1.2%) David 14 (1.2%) Giorgio 14 (1.2%) Serdar Tumgoren 14 (1.2%) Grigor Kolev 13 (1.1%) Eike Welk 13 (1.1%) Christian Witts 12 (1.0%) invincible patriot 12 (1.0%) No more spamming now :P ~l0nwlf On Fri, Feb 26, 2010 at 9:10 AM, Shashwat Anand wrote: > 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%) > Wayne 112 (1.4%) > Sander Sweers 111 (1.4%) > Serdar Tumgoren 100 (1.3%) > Luke Paireepinart 99 (1.3%) > wesley chun 99 (1.3%) > W W 74 (1.0%) > Marc Tompkins 72 (0.9%) > A.T.Hofkamp 71 (0.9%) > Robert Berman 68 (0.9%) > vince spicer 63 (0.8%) > Emad Nawfal 62 (0.8%) > Andre Engels 61 (0.8%) > Rich Lovely 60 (0.8%) > Christian Witts 57 (0.7%) > Martin Walsh 51 (0.7%) > Eduardo Vieira 47 (0.6%) > Tim Golden 47 (0.6%) > prasad rao 47 (0.6%) > Dinesh B Vadhia 47 (0.6%) > John Fouhy 42 (0.5%) > Norman Khine 41 (0.5%) > Che M 41 (0.5%) > Stephen Nelson-Smith 40 (0.5%) > Mark Tolonen 40 (0.5%) > Chris Fuller 38 (0.5%) > Stefan Behnel 35 (0.5%) > Wayne Werner 34 (0.4%) > Steve Willoughby 32 (0.4%) > Shashwat Anand 32 (0.4%) > Eike Welk 31 (0.4%) > Albert-Jan Roskam 30 (0.4%) > > ~l0nwlf > > > On Fri, Feb 26, 2010 at 9:04 AM, Shashwat Anand > wrote: > >> 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 >>> >>> 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%) >>> Wayne 112 (1.4%) >>> Sander Sweers 111 (1.4%) >>> Serdar Tumgoren 100 (1.3%) >>> Luke Paireepinart 99 (1.3%) >>> wesley chun 99 (1.3%) >>> W W 74 (1.0%) >>> Marc Tompkins 72 (0.9%) >>> A.T.Hofkamp 71 (0.9%) >>> Robert Berman 68 (0.9%) >>> vince spicer 63 (0.8%) >>> Emad Nawfal 62 (0.8%) >>> >>> Alan, congratulations, you pulled ahead of me for the first time in >>> years! You posted more than in 2008, I posted less. Overall posts are >>> up from last year, which was the slowest year since I started >>> measuring (2003). >>> >>> Thank you to everyone who asks and answers questions here! >>> >>> The rankings are compiled by scraping the monthly author pages from >>> the tutor archives, using Beautiful Soup to extract author names. I >>> consolidate counts for different capitalizations of the same name but >>> not for different spellings. The script is below. >>> >>> Kent >>> >>> ''' Counts all posts to Python-tutor by author''' >>> # -*- coding: latin-1 -*- >>> from datetime import date, timedelta >>> import operator, urllib2 >>> from BeautifulSoup import BeautifulSoup >>> >>> today = date.today() >>> >>> for year in range(2009, 2010): >>>startDate = date(year, 1, 1) >>>endDate = date(year, 12, 31) >>>thirtyOne = timedelta(days=31) >>>counts = {} >>> >>># Collect all the counts for a year by scraping the monthly author >>> archive pages >>>while startDate < endDate and startDate < today: >>>dateString = startDate.strftime('%Y-%B') >>> >>>url = 'http://mail.python.org/pipermail/tutor/%s/author.html' >>> % dateString >>>data = urllib2.urlopen(url).read() >>>soup = BeautifulSoup(data) >>> >>>li = soup.findAll('li')[2:-2] >>> >>>for l in li: >>>name = l.i.string.strip() >>>counts[name] = counts.get(name, 0) + 1 >>> >>>startDate += thirtyOne >>> >>># Consolidate names that vary by case under the most popular spelling >>>nameMap = dict() # Map lower-case name to most popular name >>> >>># Use counts.items() so we can delete from the dict. >>>for name, count in sorted(counts.items(), >>> key=operator.itemgetter(1), reverse=True): >>> lower = name.lower() >>> if lower in nameMap: >>> # Add counts for a name we have seen already and remove the >>> duplicate >>> counts[nameMap[lower]] += count >>> del counts[name] >>> else: >>> nameMap[lower] = name >>> >>>totalPosts = sum(counts.itervalues()) >>>posters = len(counts) >>> >>>p
Re: [Tutor] returning to my quest
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 the server. > > I still have no idea what you are asking for. What is a WEBMAIL > portal? Are you trying to access mail that has a web interface, or > create a web interface for an existing POP mailbox, or what? > > Oh, and what does this have to do with Python? I'm pretty sure he wants to be able to install some python software on a server that will provide a web interface for accessing a POP mail account. For PHP there's squirrel mail, horde imp, roundcube, etc. I can't seem to find any at all for Python, at least none that have been worked on in the last 5 years. Does anyone else know? Thanks, benno ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] PyAutoRun
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 intend to develop this further(with a bit of help) and will request for its addition into debian and ubuntu repositories, in time. Also, any kind of code-review, criticism, is also appreciated. However, it`d be awesome if you could just fork it at github, pull, modify and push. :) Have a nice day! cheers!!! Zubin ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor