Re: Query windows event log with python

2013-01-14 Thread Tim Golden
On 13/01/2013 05:55, robey.lawre...@gmail.com wrote: > On Saturday, January 12, 2013 8:34:01 PM UTC+11, Tim Golden wrote: >> On 12/01/2013 06:09, email.addr...@gmail.com wrote: >> >>> I am looking to write a short program to query the windows event >> >>> log. >> >>> >> >>> It needs to ask the

Re: Thought of the day

2013-01-14 Thread Dave Angel
On 01/13/2013 11:16 PM, Steven D'Aprano wrote: > A programmer had a problem, and thought Now he has "I know, I'll solve > two it with threads!" problems. > > ++10 I've been thinking about threads lately, and have come to the tentative conclusion that they're a solution which has outlived its use

Making a logging handler that produces context.

2013-01-14 Thread Antoon Pardon
I have some in house code for which I am considering replacing the logging code with something that uses the logging module. The code is typically used as a cron job with everything higher than info logged to a file and everything higher than warning logged to stderr. However there is one thing

Re: Thought of the day

2013-01-14 Thread alex23
On Jan 14, 2:16 pm, Steven D'Aprano wrote: > A programmer had a problem, and thought Now he has "I know, I'll solve > two it with threads!" problems. I laughed far far longer than I should have, cheers :) -- http://mail.python.org/mailman/listinfo/python-list

Re: Making a logging handler that produces context.

2013-01-14 Thread Peter Otten
Antoon Pardon wrote: > I have some in house code for which I am considering replacing the > logging code with something that uses the logging module. > However there is one thing the in-house log code does, that seems > difficult to do with the logging module, provide some context. The > in-hous

Re: how to detect the character encoding in a web page ?

2013-01-14 Thread Albert van der Horst
In article , Roy Smith wrote: >In article , > Alister wrote: > >> Indeed due to the poor quality of most websites it is not possible to be >> 100% accurate for all sites. >> >> personally I would start by checking the doc type & then the meta data as >> these should be quick & correct, I then us

Re: problem with exam task for college

2013-01-14 Thread stefaang
Hi, I only skimmed through the code, but I think your problem resides at the "while True" in your brandstofmeter update(). This function never stops.. -- http://mail.python.org/mailman/listinfo/python-list

Re: Thought of the day

2013-01-14 Thread Tim Chase
On 01/13/13 22:16, Steven D'Aprano wrote: A programmer had a problem, and thought Now he has "I know, I'll solve two it with threads!" problems. A newbie programmer had a problem and thought "I'll solve it by posting on python-list@python.org and on Google Groups". And now we have the proble

Re: Thought of the day

2013-01-14 Thread Chris Angelico
On Tue, Jan 15, 2013 at 1:15 AM, Tim Chase wrote: > A newbie programmer had a problem and thought > > > > "I'll solve it by posting on > > > > python-list@python.org and on Google Groups". > > > > And now we have the problem of two threads... And, when faced with problems of having two threads, t

Re: Making a logging handler that produces context.

2013-01-14 Thread Antoon Pardon
Op 14-01-13 13:38, Peter Otten schreef: > It turns out the logic of the above is correct. The problem is that the > handler has to see the INFO-level records while the filter() method has to > reject them. The following configuration seems to achieve that: I see, I thought trowing away logrecord

Re: PyWart (Terminolgy): "Class"

2013-01-14 Thread Tim Chase
On 01/14/13 01:56, Chris Angelico wrote: On Mon, Jan 14, 2013 at 6:32 PM, Rick Johnson wrote: I really don't like using two words ("define object", or "def obj") and using one single keyword is ambiguous ("object" or "obj"). So the obvious solution is to combine the abbreviated words into one

Re: Thought of the day

2013-01-14 Thread Dan Sommers
On Mon, 14 Jan 2013 00:31:59 -0500, Dave Angel wrote: > On 01/13/2013 11:16 PM, Steven D'Aprano wrote: >> A programmer had a problem, and thought Now he has "I know, I'll solve >> two it with threads!" problems. > > ++10 It took me a moment to figure it out, but in the end I smiled and I agree:

Re: PyWart (Terminolgy): "Class"

2013-01-14 Thread Dan Sommers
On Mon, 14 Jan 2013 18:56:08 +1100, Chris Angelico wrote: > Awesome! Now, just one more step to make Python into the World's Most > Awesome Language(tm): Replace those lengthy words with single symbols > found in the Unicode set; compress everything down and enforce perfect > Unicode handling. Als

[ANN] pyspread 0.2.3

2013-01-14 Thread Martin Manns
== pyspread 0.2.3 == Pyspread 0.2.3 is released. The new version improves GPG integration. About pyspread == Pyspread is a non-traditional spreadsheet application that is based on and written in the programming language Python. The goal of pyspread is to

Python modules

2013-01-14 Thread zoom
Is there any "rules" regarding importing python modules within your own module? I mean, how does this affects the performance of the program? For example, I have my own module named "sound". At the top of the file sound.py I have: import scipy In the code I have: import scipy, sound, etc Now I

Re: Python modules

2013-01-14 Thread Chris Angelico
On Tue, Jan 15, 2013 at 1:54 AM, zoom wrote: > Is there any "rules" regarding importing python modules within your own > module? I mean, how does this affects the performance of the program? > > In short, when creating a module, is it worthwhile to be careful and import > only necessary functions,

Re: Python modules

2013-01-14 Thread zoom
On 01/14/2013 04:01 PM, Dan Sommers wrote: On Mon, 14 Jan 2013 15:54:27 +0100, zoom wrote: Is there any "rules" regarding importing python modules within your own module? I mean, how does this affects the performance of the program? "Even the initializers are optimized!" -- Mel, the real prog

Re: Python modules

2013-01-14 Thread Dan Sommers
On Mon, 14 Jan 2013 15:54:27 +0100, zoom wrote: > Is there any "rules" regarding importing python modules within your own > module? I mean, how does this affects the performance of the program? "Even the initializers are optimized!" -- Mel, the real programmer Unless you've profiled it, and the

Re: Thought of the day

2013-01-14 Thread Grant Edwards
On 2013-01-14, Steven D'Aprano wrote: > A programmer had a problem, and thought Now he has "I know, I'll solve > two it with threads!" problems. :) That took a few seconds -- must be the cold. -- Grant Edwards grant.b.edwardsYow! I hope I bought the

Re: problem with exam task for college

2013-01-14 Thread jeltedeproft
this is what i have right now, it tells me i can't multiply a vector with a vector, i have to find a way to multiply the speed with the updated angle (=hoek in dutch) code : from visual import * import time import math import random class lunar_lander(object): def __init__(self):

Re: Python modules

2013-01-14 Thread Rick Johnson
On Monday, January 14, 2013 9:04:00 AM UTC-6, Chris Angelico wrote: > The performance cost of reimporting a module is very low; > in fact, trying to avoid it by adorning all your usage > with an extra dot-level will probably cost you a lot more, > since there'll be an extra lookup every time. Most

Re: Thought of the day

2013-01-14 Thread Dave Angel
On 01/14/2013 09:44 AM, Dan Sommers wrote: > On Mon, 14 Jan 2013 00:31:59 -0500, Dave Angel wrote: > >> On 01/13/2013 11:16 PM, Steven D'Aprano wrote: >>> A programmer had a problem, and thought Now he has "I know, I'll solve >>> two it with threads!" problems. >> ++10 > It took me a moment to figu

Re: PyWart (Terminolgy): "Class"

2013-01-14 Thread Steven D'Aprano
On Sun, 13 Jan 2013 22:46:44 -0800, Rick Johnson wrote: > I have believed for a very long time that "class" was a poor choice of > keyword to designate an "object definition". > > Firstly, the word /class/ does not transform smoothly into CS from > English. NO English definition of "class" comes

Re: Thought of the day

2013-01-14 Thread Demian Brecht
I love getting that "what's up with this guy" when I start chuckling so hard that I nearly spit out my coffee first thing Monday morning. Thank you sir, this has given my week a bright start :) Demian Brecht http://demianbrecht.github.com On 2013-01-13 8:16 PM, "Steven D'Aprano" wrote: >A p

Re: Thought of the day

2013-01-14 Thread Demian Brecht
Š And I hope you don't mindŠ I may very well "borrow" this as my e-mail sig. Comedic gold imo. Demian Brecht http://demianbrecht.github.com On 2013-01-13 8:16 PM, "Steven D'Aprano" wrote: >A programmer had a problem, and thought Now he has "I know, I'll solve >two it with threads!" problems.

Re: PyWart: Module access syntax

2013-01-14 Thread Steven D'Aprano
On Sun, 13 Jan 2013 21:22:57 -0800, Rick Johnson wrote: > On Saturday, January 12, 2013 12:45:03 AM UTC-6, Steven D'Aprano wrote: >> On Fri, 11 Jan 2013 20:34:20 -0800, Rick Johnson wrote: >> > [...] >> So what do you do for, say, os.path? According to the first rule, you >> must write it as os:pa

Re: Thought of the day

2013-01-14 Thread Michael Torrie
On 01/13/2013 09:16 PM, Steven D'Aprano wrote: > A programmer had a problem, and thought Now he has "I know, I'll solve > two it with threads!" problems. The same applies to regular expressions, which is actually what the expression was first used with years ago. Probably applies to just about a

Re: proposal: Ellipsis in argument list

2013-01-14 Thread Chris Kaynor
On Sat, Jan 12, 2013 at 5:30 AM, Szabolcs Blága wrote: > Dear All, > > I have an idea that the Ellipsis object could be used in function calls. > The "..." syntax should automagically turn into an Ellipsis positional > argument. > > def f(*args): > ext_args = [] > for i, a in enumerate(args):

Re: PyWart (Terminolgy): "Class"

2013-01-14 Thread Tim Chase
On 01/14/13 11:26, Steven D'Aprano wrote: Your knowledge of English has failed you. Here is the first definition from Webster's Dictionary (1913 edition): Class \Class\ (kl[.a]s), n. [F. classe, fr. L. classis class, collection, fleet; akin to Gr. klh^sis a calling, kalei^n to call, E.

Re: Thought of the day

2013-01-14 Thread John Gordon
In Michael Torrie writes: > On 01/13/2013 09:16 PM, Steven D'Aprano wrote: > > A programmer had a problem, and thought Now he has "I know, I'll solve > > two it with threads!" problems. > The same applies to regular expressions, which is actually what the > expression was first used with year

Re: Thought of the day

2013-01-14 Thread Michael Torrie
On 01/14/2013 11:09 AM, John Gordon wrote: > In Michael Torrie > writes: > >> On 01/13/2013 09:16 PM, Steven D'Aprano wrote: >>> A programmer had a problem, and thought Now he has "I know, I'll solve >>> two it with threads!" problems. > >> The same applies to regular expressions, which is ac

Re: PyWart: Module access syntax

2013-01-14 Thread Ian Kelly
On Sun, Jan 13, 2013 at 10:22 PM, Rick Johnson wrote: > You are missing the point of this syntax. The colon is to access MODULE > NAMESPACE. The dot is to access MODULE MEMBERS. A module CAN BE another > module's MEMBER. > > You are also unable to grasp this simple logical fact: Once you arrive

Re: PyWart: Module access syntax

2013-01-14 Thread Ian Kelly
On Mon, Jan 14, 2013 at 11:51 AM, Ian Kelly wrote: >> Because modules and objects are not the same and someone who is reading the >> source code NEEDS to know which "path members" are /modules/ and which "path >> members" are /objects/. And he needs to know that very important >> information W

Re: PyWart: Module access syntax

2013-01-14 Thread D'Arcy J.M. Cain
On Mon, 14 Jan 2013 11:51:50 -0700 Ian Kelly wrote: > On Sun, Jan 13, 2013 at 10:22 PM, Rick Johnson > wrote: ...Whatever > If you want us to understand the syntax, then you need to define If you are going to feed the trolls can I please ask that you Cc them or send to them and Cc the list? Tha

Re: PyWart (Terminolgy): "Class"

2013-01-14 Thread Peter
Real mature lot of responses here guys - shows how much you have grown up. Reading this thread looked more like observing a bunch of 3rd grader - somebody offers an opinion and all you can do is ridicule it? Real mature - certainly gives Python a good name having followers like this... But then

Re: Python modules

2013-01-14 Thread Grant Edwards
On 2013-01-14, Rick Johnson wrote: > Only a fool would do "from Tkinter import *"[2]. > [2] With the exception of command line testing, learning, or playing. I don't think those should be excepted. Habits acquired during learning/playing will be continue when doing real work, and "Example" code

Finding the variables (read or write)

2013-01-14 Thread servekarimi
I'd like to develop a small debugging tool for python programs.In Dynamic Slicing How can I find the variables that are accessed in a statement? And find the type of access (read or write) for those variables (in Python). ### Write: A statement can change the program state. ### Read : A statement

unit selection problem

2013-01-14 Thread Paul Pittlerson
Unit selection doesn't work properly. Pygames event.pos returns a tuple of the coords within the current window, so it's not possible to select units outside of the top left corner. from pygamehelper import * from pygame import * from pygame.locals import * from vec2d import * from math import e

Re: PyWart: Module access syntax

2013-01-14 Thread Ian Kelly
On Mon, Jan 14, 2013 at 12:35 PM, D'Arcy J.M. Cain wrote: > On Mon, 14 Jan 2013 11:51:50 -0700 > Ian Kelly wrote: >> On Sun, Jan 13, 2013 at 10:22 PM, Rick Johnson >> wrote: > ...Whatever > >> If you want us to understand the syntax, then you need to define > > If you are going to feed the troll

Re: PyWart (Terminolgy): "Class"

2013-01-14 Thread Chris Angelico
On Tue, Jan 15, 2013 at 6:43 AM, Peter wrote: > Real mature lot of responses here guys - shows how much you have grown up. > > Reading this thread looked more like observing a bunch of 3rd grader - > somebody offers an opinion and all you can do is ridicule it? > > Real mature - certainly gives P

Re: PyWart (Terminolgy): "Class"

2013-01-14 Thread Tim Delaney
On 15 January 2013 07:57, Chris Angelico wrote: > > Oh, and Dennis? Mal. Bad. From the Latin. :) > I was about to point out the same thing, using the same quote ;) Tim Delaney -- http://mail.python.org/mailman/listinfo/python-list

Re: Finding the variables (read or write)

2013-01-14 Thread Chris Angelico
On Tue, Jan 15, 2013 at 6:48 AM, wrote: > I'd like to develop a small debugging tool for python programs.In Dynamic > Slicing How can I find the variables that are accessed in a statement? And > find the type of access (read or write) for those variables (in Python). > ### Write: A statement ca

Re: Finding the variables (read or write)

2013-01-14 Thread Chris Kaynor
On Mon, Jan 14, 2013 at 1:28 PM, Chris Angelico wrote: > On Tue, Jan 15, 2013 at 6:48 AM, wrote: > > I'd like to develop a small debugging tool for python programs.In > Dynamic Slicing How can I find the variables that are accessed in a > statement? And find the type of access (read or write) f

Re: Finding the variables (read or write)

2013-01-14 Thread Terry Reedy
On 1/14/2013 4:28 PM, Chris Angelico wrote: On Tue, Jan 15, 2013 at 6:48 AM, wrote: I'd like to develop a small debugging tool for python programs.In Dynamic Slicing How can I find the variables that are accessed in a statement? And find the type of access (read or write) for those variables

Re: Finding the variables (read or write)

2013-01-14 Thread Chris Angelico
On Tue, Jan 15, 2013 at 8:37 AM, Chris Kaynor wrote: > And those aren't even covering the case that a, normally non-mutating, > method actually mutates. If it's static analysis, I'd quietly ignore those sorts of cases. Anything can be changed any time, including stuff that's completely unrelated

Re: PyWart (Terminolgy): "Class"

2013-01-14 Thread Rhodri James
On Mon, 14 Jan 2013 19:43:34 -, Peter wrote: Real mature lot of responses here guys - shows how much you have grown up. Reading this thread looked more like observing a bunch of 3rd grader - somebody offers an opinion and all you can do is ridicule it? Now read the rest of the thread

strace of python shows nonsense

2013-01-14 Thread Joep van Delft
Hi there, I am puzzled at how I borked my installation. Python loads slow on my machine, and I decided to use strace and /usr/bin/time to see what is actually happening. # sync && echo 3 > /proc/sys/vm/drop_caches $ /usr/bin/time python2 -c "" 0.19user 0.04system 0:01.22elapsed 19%CPU (0avgtex

Re: PyWart (Terminolgy): "Class"

2013-01-14 Thread Dan Sommers
On Mon, 14 Jan 2013 12:00:13 -0600, Tim Chase wrote: > Clearly Python should use a keyword like "Kingdom" or "Phylum" instead. > I guess "Kingdom" should be reserved for metaclasses (or would they be > metaphylums? or metaphyla?) Metaphyla, of course. >kingdom Baz: > pass > >phy

Re: PyWart (Terminolgy): "Class"

2013-01-14 Thread Steven D'Aprano
On Tue, 15 Jan 2013 07:57:58 +1100, Chris Angelico wrote: > Rick Johnson is a well-known troll. I disagree that Rick is a troll. Trolling requires that the troll makes statements that he doesn't believe are true, simply in order to get a response. I do not believe that Rick is doing that. I thi

Re: PyWart (Terminolgy): "Class"

2013-01-14 Thread D'Arcy J.M. Cain
On 15 Jan 2013 02:08:38 GMT Steven D'Aprano wrote: > > Rick Johnson is a well-known troll. > > I disagree that Rick is a troll. Trolling requires that the troll Doesn't matter. He duck types as one. -- D'Arcy J.M. Cain | Democracy is three wolves http://www.druid.net/darcy/

code explanation

2013-01-14 Thread Rodrick Brown
Can someone explain what's going on here. def _build_magic_dispatcher(method): def inner(self, *args, **kwargs): return self.__dict__[method](*args, **kwargs) inner.__name__ = method return inner Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: strace of python shows nonsense

2013-01-14 Thread Steven D'Aprano
On Tue, 15 Jan 2013 00:50:01 +0100, Joep van Delft wrote: > Hi there, > > > I am puzzled at how I borked my installation. Python loads slow on my > machine, and I decided to use strace and /usr/bin/time to see what is > actually happening. Before dropping down to such a low level, I suggest you

Re: code explanation

2013-01-14 Thread Steven D'Aprano
On Mon, 14 Jan 2013 23:00:16 -0500, Rodrick Brown wrote: > Can someone explain what's going on here. > > def _build_magic_dispatcher(method): > def inner(self, *args, **kwargs): > return self.__dict__[method](*args, **kwargs) > inner.__name__ = method > return inner > > Thank

Re: code explanation

2013-01-14 Thread Terry Reedy
On 1/14/2013 11:00 PM, Rodrick Brown wrote: Can someone explain what's going on here. def _build_magic_dispatcher(method): def inner(self, *args, **kwargs): return self.__dict__[method](*args, **kwargs) inner.__name__ = method return inner Nothing, until you run that wi

Re: code explanation

2013-01-14 Thread Rodrick Brown
On Mon, Jan 14, 2013 at 11:38 PM, Steven D'Aprano < steve+comp.lang.pyt...@pearwood.info> wrote: > On Mon, 14 Jan 2013 23:00:16 -0500, Rodrick Brown wrote: > > > Can someone explain what's going on here. > > > > def _build_magic_dispatcher(method): > > def inner(self, *args, **kwargs): > >

Re: code explanation

2013-01-14 Thread Ian Kelly
On Mon, Jan 14, 2013 at 9:51 PM, Rodrick Brown wrote: > import sys > > PY3K = sys.version_info >= (3,) > > > methods = set([ > "__iter__", > "__len__", > "__contains__", > > "__lt__", > "__le__", > "__eq__", > "__ne__", > "__gt__", > "__ge__", > > "__add__",

Re: PyWart (Terminolgy): "Class"

2013-01-14 Thread Rick Johnson
On Monday, January 14, 2013 11:26:37 AM UTC-6, Steven D'Aprano wrote: > On Sun, 13 Jan 2013 22:46:44 -0800, Rick Johnson wrote: > [...] > Your knowledge of English has failed you. Here is the first definition > from Webster's Dictionary (1913 edition): > > Class [...] >1. A group of individua

sqlite3 puzzle

2013-01-14 Thread llanitedave
I'm trying to get an application working in Python 2.7 and wx.Python which contains an embedded sqlite3 file. There are a few tables with foreign keys defined. In looking at the sqlite3 documentation, it says "Assuming the library is compiled with foreign key constraints enabled, it must sti

Re: PyWart: Module access syntax

2013-01-14 Thread Rick Johnson
On Monday, January 14, 2013 11:34:56 AM UTC-6, Steven D'Aprano wrote: > Since both os and path are modules, you here say that they need a colon > between them. This contradicts the above when you say the syntax for > os.path won't change. But you forgot the rule about accessing module members w

Re: strace of python shows nonsense

2013-01-14 Thread Dieter Maurer
Joep van Delft writes: > ... > What puzzles me, is the amount of errors for open and stat64. The high number of errors comes from Python's import logic: when Python should import a module/package (not yet imported), it looks into each member on "sys.path" for about 6 different potential filename

Re: PyWart: Module access syntax

2013-01-14 Thread Rick Johnson
On Monday, January 14, 2013 12:51:50 PM UTC-6, Ian wrote: > I think the distinction you are trying to make here is based upon the > submodule's actual source location on the disk. If you have a package > folder A which contains a file B.py, then you would access that as > A:B, correct? If on the