Re: What is a shortcut to the Default home directory in Windows

2008-01-18 Thread Tim Golden
Christian Heimes wrote: > Mike Driscoll wrote: >> I personally use Tim Golden's excellent win32 API wrapper, the >> winshell script. You can find it here: >> >> http://timgolden.me.uk/python/winshell.html > > Yeah. Tim's winshell is fine but it's not using the official win32 api. Umm... Is it not

Re: TopSort in Python?

2008-01-18 Thread Paddy
On Jan 19, 1:08 am, Carl Banks <[EMAIL PROTECTED]> wrote: > > Ten minutes later I saw it mentioned it on comp.lang.python. It's almost as if you looking for it made it popular :-) - Paddy. -- http://mail.python.org/mailman/listinfo/python-list

ANN: pyharu-2.0.8, the interface to libharu(PDF generate lib)

2008-01-18 Thread oyster
Pyharu is a pure python interface to haru(Haru Free PDF Library, http://libharu.sourceforge.net/) via ctypes. All of the C API is usable. All the example programs in haru C src has been ported. It (should) run on windows/linux without modification. Pyharu is only 1M, which is small and easy to use

Re: Unique thread ID

2008-01-18 Thread Benjamin
On Jan 18, 8:31 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Fri, 18 Jan 2008 22:41:47 -0300, Benjamin <[EMAIL PROTECTED]> > escribió: > > > On Jan 18, 2:31 am, Christian Heimes <[EMAIL PROTECTED]> wrote: > >> Benjamin wrote: > >> > Is there a way to obtain a unique ID for the current th

Re: Unique thread ID

2008-01-18 Thread Gabriel Genellina
En Fri, 18 Jan 2008 22:41:47 -0300, Benjamin <[EMAIL PROTECTED]> escribió: > On Jan 18, 2:31 am, Christian Heimes <[EMAIL PROTECTED]> wrote: >> Benjamin wrote: >> > Is there a way to obtain a unique ID for the current thread? I have an >> > object that I need to store local thread data in, and I

Re: I don't understand what is happening in this threading code

2008-01-18 Thread Sergio Correia
This is what's happening: 1) The chef thread releases the sema 2) While the chef thread is saying "Andiamo", decreasing "i", and ending the while loop, the waiter thread SERVES the dish and RUNS to reacquire the lock 3) Back in the main loop, chef.join() is run, and then the waiter's variable i

Re: I don't understand what is happening in this threading code

2008-01-18 Thread Carl Banks
On Jan 18, 7:43 pm, Matthew Wilson <[EMAIL PROTECTED]> wrote: > In this code, I tried to kill my thread object by setting a variable on it > to False. > > Inside the run method of my thread object, it checks a different > variable. > > I've already rewritten this code to use semaphores, but I'm jus

Re: Unique thread ID

2008-01-18 Thread Benjamin
On Jan 18, 2:31 am, Christian Heimes <[EMAIL PROTECTED]> wrote: > Benjamin wrote: > > Is there a way to obtain a unique ID for the current thread? I have an > > object that I need to store local thread data in, and I don't want to > > use threading.local because each thread might have multiple inst

Re: TopSort in Python?

2008-01-18 Thread Carl Banks
On Jan 18, 7:01 pm, Paddy <[EMAIL PROTECTED]> wrote: > On Jan 18, 9:47 pm, [EMAIL PROTECTED] wrote:> Tim, > > > Thanks for the topsort code. It would be useful in a project I'm > > working on. Can I use the code for free under public domain? Thanks! > > When I needed one I didn't know the name.

Re: Efficient processing of large nuumeric data file

2008-01-18 Thread bearophileHUGS
...and just for fun this D code is about 3.2 times faster than the Psyco version for the same dataset (30% lines with a space): import std.stdio, std.conv, std.string, std.stream; int[int] get_hist(string file_name) { int[int] hist; foreach(string line; new BufferedFile(file_name)) {

I don't understand what is happening in this threading code

2008-01-18 Thread Matthew Wilson
In this code, I tried to kill my thread object by setting a variable on it to False. Inside the run method of my thread object, it checks a different variable. I've already rewritten this code to use semaphores, but I'm just curious what is going on. Here's the code: import logging, threading,

Re: Efficient processing of large nuumeric data file

2008-01-18 Thread bearophileHUGS
Matt: > from collections import defaultdict > > def get_hist(file_name): > hist = defaultdict(int) > f = open(filename,"r") > for line in f: > vals = line.split() > val = int(vals[0]) > try: # don't look to see if you will cause an error, > # just c

Re: TopSort in Python?

2008-01-18 Thread Paul Rubin
Paddy <[EMAIL PROTECTED]> writes: > When I needed one I didn't know the name. I'm curious, how did you > know to look for the topological sort algorithm by name? It's a well known algorithm in computer science, described in any number of textbooks, for example probably http://projects.csail.m

Re: Core Python Programming . . .

2008-01-18 Thread Yu-Xi Lim
Mike Driscoll wrote: > > 6-11 Conversion. > (a) Create a program that will convert from an integer to an > Internet Protocol (IP) address in the four-octet format of WWW.XXX.YYY.ZZZ > (b) Update your program to be able to do the vice verse of the > above. I think it's is asking to convert a 3

Re: TopSort in Python?

2008-01-18 Thread Paddy
On Jan 18, 9:47 pm, [EMAIL PROTECTED] wrote: > Tim, > > Thanks for the topsort code. It would be useful in a project I'm > working on. Can I use the code for free under public domain? Thanks! > When I needed one I didn't know the name. I'm curious, how did you know to look for the topological so

Re: strange syntax rules on list comprehension conditions

2008-01-18 Thread Dustan
On Jan 18, 1:04 pm, "Chris Mellon" <[EMAIL PROTECTED]> wrote: > On Jan 18, 2008 12:53 PM, Nicholas <[EMAIL PROTECTED]> wrote: > > > I was quite delighted today, after extensive searches yielded nothing, to > > discover how to place an else condition in a list comprehension. > > Trivial mask example

Re: What is a shortcut to the Default home directory in Windows

2008-01-18 Thread Christian Heimes
Mike Driscoll wrote: > I personally use Tim Golden's excellent win32 API wrapper, the > winshell script. You can find it here: > > http://timgolden.me.uk/python/winshell.html Yeah. Tim's winshell is fine but it's not using the official win32 api. However Python 2.6 will get an easier way to get a

Re: Using "pickle" for interprocess communication - some notes and things that ought to be documented.

2008-01-18 Thread Paul Boddie
On 18 Jan, 07:32, John Nagle <[EMAIL PROTECTED]> wrote: > > "Processing" is useful, but it uses named pipes and sockets, > not ordinary pipes. Also, it has C code, so all the usual build > and version problems apply. The pprocess module uses pickles over sockets, mostly because the asynchrono

Re: Efficient processing of large nuumeric data file

2008-01-18 Thread Steven D'Aprano
On Fri, 18 Jan 2008 09:58:57 -0800, Paul Rubin wrote: > David Sanders <[EMAIL PROTECTED]> writes: >> The data files are large (~100 million lines), and this code takes a >> long time to run (compared to just doing wc -l, for example). > > wc is written in carefully optimized C and will almost cer

Re: Efficient processing of large nuumeric data file

2008-01-18 Thread Steven D'Aprano
On Fri, 18 Jan 2008 12:06:56 -0600, Tim Chase wrote: > I don't know how efficient len() is (if it's internally linearly > counting the items in data, or if it's caching the length as data is > created/assigned/modifed) It depends on what argument you pass to len(). Lists, tuples and dicts (and m

Re: Is this a bug, or is it me?

2008-01-18 Thread Steven D'Aprano
On Fri, 18 Jan 2008 11:01:29 -0800, cptnwillard wrote: > Now here is another one for your enjoyment: > > class C: > @staticmethod > def f1(): pass > F = { '1' : f1 } > > C().F['1']() > TypeError: 'staticmethod' object is not callable > > > What do you think of this one?

Re: strange syntax rules on list comprehension conditions

2008-01-18 Thread Paul McGuire
On Jan 18, 1:04 pm, "Chris Mellon" <[EMAIL PROTECTED]> wrote: > On Jan 18, 2008 12:53 PM, Nicholas <[EMAIL PROTECTED]> wrote: > > > I was quite delighted today, after extensive searches yielded nothing, to > > discover how to place an else condition in a list comprehension. > > Trivial mask example

Re: Is this a bug, or is it me?

2008-01-18 Thread Peter Otten
cptnwillard wrote: > I filed a bug report, and here is the short answer to my question: > genexps are code blocks, and code blocks cannot see variables in class > scopes. Congrats to Neil Cerutti who figured it out. > > Now here is another one for your enjoyment: > > class C: > @staticmeth

Re: What is a shortcut to the Default home directory in Windows

2008-01-18 Thread Mike Driscoll
On Jan 18, 2:19 pm, Daniel Folkes <[EMAIL PROTECTED]> wrote: > I am trying to write a file to the users file system. > > I need it to be in there home directory in WINDOWS. I know there is a > "shortcut" to home in Linux("~"), but is there an equivalent to that > in windows. Or to get to their "D

Re: Core Python Programming . . .

2008-01-18 Thread Mike Driscoll
On Jan 18, 1:55 pm, Paul Rubin wrote: > FireNWater <[EMAIL PROTECTED]> writes: > > 1) convert a 4-digit Integer (WXYZ) to an IP address (WWW.XXX.YYY.ZZZ) > > > or > > > 2) convert an 8-digit Integer (WWWXXXYYYZZZ) to (WWW.XXX.YYY.ZZZ) > > > Thanks for anyone with the clue

Re: Is this a bug, or is it me?

2008-01-18 Thread Neil Cerutti
On 1/18/08, Ross Ridge <[EMAIL PROTECTED]> wrote: > Neil Cerutti <[EMAIL PROTECTED]> wrote: > >The decoration is setting the class type's f1 attribute correctly, but > >doing something strange in the local namespace. > > > class C: > >... @staticmethod > >... def f1(): pass > >... print

Re: TopSort in Python?

2008-01-18 Thread startech84
Tim, Thanks for the topsort code. It would be useful in a project I'm working on. Can I use the code for free under public domain? Thanks! On Jun 30 1999, 11:00 pm, "Tim Peters" <[EMAIL PROTECTED]> wrote: > From: "Tim Peters" <[EMAIL PROTECTED]> > > [Dinu C. Gherman] > > > Does anybody have a

Re: Bit Scan Forward and Reverse

2008-01-18 Thread [EMAIL PROTECTED]
On Jan 18, 2:01 pm, Thomas Dybdahl Ahle <[EMAIL PROTECTED]> wrote: > Hi, I'm writing an app in python, and I'm storing some a lot of data in > bitmaps. > I need a way to find the first or latest set bit in a 64bit number, and > for that I've implemented a small routine. > > Thing is that this routi

Re: Is this a bug, or is it me?

2008-01-18 Thread Ross Ridge
Neil Cerutti <[EMAIL PROTECTED]> wrote: >The decoration is setting the class type's f1 attribute correctly, but >doing something strange in the local namespace. > class C: >... @staticmethod >... def f1(): pass >... print f1 >... > print C.f1 > It might help understand the problem

Re: "Code Friendly" Blog?

2008-01-18 Thread Hai Vu
Miki, Why don't you try to use Code Colorizer: http://www.chamisplace.com/colorizer/cc.asp -- http://mail.python.org/mailman/listinfo/python-list

Re: Using "pickle" for interprocess communication - some notes and things that ought to be documented.

2008-01-18 Thread John Nagle
Carl Banks wrote: > On Jan 17, 2:28 pm, John Nagle <[EMAIL PROTECTED]> wrote: > >> It's also necessary to call Pickle's "clear_memo" before each "dump" >> call, since objects might change between successive "dump" calls. >> "Unpickle" doesn't have a "clear_memo" function. It should, because >> i

Re: Bit Scan Forward and Reverse

2008-01-18 Thread Matimus
On Jan 18, 12:01 pm, Thomas Dybdahl Ahle <[EMAIL PROTECTED]> wrote: > Hi, I'm writing an app in python, and I'm storing some a lot of data in > bitmaps. > I need a way to find the first or latest set bit in a 64bit number, and > for that I've implemented a small routine. > > Thing is that this rout

IRC bot threading dilemma

2008-01-18 Thread bakermi
Hello, I have coded an IRC bot in Python. Each inbound packet is parsed, and once the bot decides whether it is a command directed at the bot or not, it will either discard the packet or make a function call to an access control checker function. If the invoking user is found to have sufficient ac

Re: What is a shortcut to the Default home directory in Windows

2008-01-18 Thread Jerry Hill
On Jan 18, 2008 3:19 PM, Daniel Folkes <[EMAIL PROTECTED]> wrote: > I am trying to write a file to the users file system. > > I need it to be in there home directory in WINDOWS. I know there is a > "shortcut" to home in Linux("~"), but is there an equivalent to that > in windows. Or to get to the

Re: Is this a bug, or is it me?

2008-01-18 Thread Neil Cerutti
On Jan 18, 2008 2:01 PM, <[EMAIL PROTECTED]> wrote: > Now here is another one for your enjoyment: > > class C: > @staticmethod > def f1(): pass > F = { '1' : f1 } > > C().F['1']() > > >>> TypeError: 'staticmethod' object is not callable > > > What do you think of this one?

Re: What is a shortcut to the Default home directory in Windows

2008-01-18 Thread Christian Heimes
Daniel Folkes wrote: > I am trying to write a file to the users file system. > > I need it to be in there home directory in WINDOWS. I know there is a > "shortcut" to home in Linux("~"), but is there an equivalent to that > in windows. Or to get to their "Documents and Settings" directory? > >

What is a shortcut to the Default home directory in Windows

2008-01-18 Thread Daniel Folkes
I am trying to write a file to the users file system. I need it to be in there home directory in WINDOWS. I know there is a "shortcut" to home in Linux("~"), but is there an equivalent to that in windows. Or to get to their "Documents and Settings" directory? Thanks in advance for the help. -D

Re: how to resolve Windows pathnames into cygwin ones

2008-01-18 Thread [EMAIL PROTECTED]
Well yes, I was hoping for a library function, but none provides it. Thanks for the code. Works nicely. On Jan 18, 12:12 pm, apatheticagnostic <[EMAIL PROTECTED]> wrote: > Here we go then (are forward slashes valid in a filename in windows?) > def path_into_cygpath(path): > drive, destination

Bit Scan Forward and Reverse

2008-01-18 Thread Thomas Dybdahl Ahle
Hi, I'm writing an app in python, and I'm storing some a lot of data in bitmaps. I need a way to find the first or latest set bit in a 64bit number, and for that I've implemented a small routine. Thing is that this routine is not as fast as I'd wish. I know most processors implement BSF an

Re: Using "pickle" for interprocess communication - some notes and things that ought to be documented.

2008-01-18 Thread Carl Banks
On Jan 17, 2:28 pm, John Nagle <[EMAIL PROTECTED]> wrote: > It's possible to use "pickle" for interprocess communication over > pipes, but it's not straightforward. > > First, "pickle" output is self-delimiting. > Each dump ends with ".", and, importantly, "load" doesn't read > any characters after

Re: Core Python Programming . . .

2008-01-18 Thread Paul Rubin
FireNWater <[EMAIL PROTECTED]> writes: > 1) convert a 4-digit Integer (WXYZ) to an IP address (WWW.XXX.YYY.ZZZ) > > or > > 2) convert an 8-digit Integer (WWWXXXYYYZZZ) to (WWW.XXX.YYY.ZZZ) > > Thanks for anyone with the clue!!! Without being able to see the exercise I suspect it's turn a 4-byte

Core Python Programming . . .

2008-01-18 Thread FireNWater
I'm working my way thru the book "Core Python Programming" 2d Edition - Wesley Chun. . . Trying to figure out what he's looking for on Page 248, Exercise 6-11 (a). Is it supposed to be: 1) convert a 4-digit Integer (WXYZ) to an IP address (WWW.XXX.YYY.ZZZ) or 2) convert an 8-digit Integer (WWW

Re: array and list

2008-01-18 Thread Paul Rubin
Travis Jensen <[EMAIL PROTECTED]> writes: > I wouldn't call it unfortunate. The list semantics follow LISP's > semantics far more closely than C's array semantics. I would hazard > to guess that they are called lists because that is what every > functional language calls them and this aspect of p

Re: Is this a bug, or is it me?

2008-01-18 Thread cptnwillard
I filed a bug report, and here is the short answer to my question: genexps are code blocks, and code blocks cannot see variables in class scopes. Congrats to Neil Cerutti who figured it out. Now here is another one for your enjoyment: class C: @staticmethod def f1(): pass

Re: Pythonland documentation

2008-01-18 Thread Mike Driscoll
On Jan 18, 12:51 pm, Simon Pickles <[EMAIL PROTECTED]> wrote: > Hi > > I am new to python (fairly) but can't stop pythonning. > > c++ seems so far away now from here it looks like a horrid scribble :) > > Anyway my question is really about doc tools. I've been used to > doxygen in c++ land,

Re: strange syntax rules on list comprehension conditions

2008-01-18 Thread Chris Mellon
On Jan 18, 2008 12:53 PM, Nicholas <[EMAIL PROTECTED]> wrote: > I was quite delighted today, after extensive searches yielded nothing, to > discover how to place an else condition in a list comprehension. > Trivial mask example: > >>> [True if i <5 else False for i in range(10)] # A > [True,

Re: array and list

2008-01-18 Thread Travis Jensen
On Jan 18, 2008, at 2:48 AM, [EMAIL PROTECTED] wrote: > J. Peng>why perl call it array and python call it list?< > > Unfortunate naming, I'd say. Calling list a dynamic array is silly, > despite all the things you may say about abstract data types having > the correct methods, etc. I wouldn't

strange syntax rules on list comprehension conditions

2008-01-18 Thread Nicholas
I was quite delighted today, after extensive searches yielded nothing, to discover how to place an else condition in a list comprehension. Trivial mask example: >>> [True if i <5 else False for i in range(10)] # A [True, True, True, True, True, False, False, False, False, False] I then exper

Pythonland documentation

2008-01-18 Thread Simon Pickles
Hi I am new to python (fairly) but can't stop pythonning. c++ seems so far away now from here it looks like a horrid scribble :) Anyway my question is really about doc tools. I've been used to doxygen in c++ land, and although it makes a reasonable stab with a python project in java mo

Re: Efficient processing of large nuumeric data file

2008-01-18 Thread Paul Rubin
Tim Chase <[EMAIL PROTECTED]> writes: > first = int(data[0]) > try: > count = int(data[1]) > except: > count = 0 By the time you're down to this kind of thing making a difference, it's probably more important to compile with pyrex or psyco. -- http://mail.python.org/mailman/listinfo

RE: Filtering two files with uncommon column

2008-01-18 Thread Reedick, Andrew
> -Original Message- > From: [EMAIL PROTECTED] [mailto:python- > [EMAIL PROTECTED] On Behalf Of Madhur > Sent: Friday, January 18, 2008 4:23 AM > To: python-list@python.org > Subject: Filtering two files with uncommon column > > > Basically I want to compare the two files based on second

Re: Bug in __init__?

2008-01-18 Thread Neil Cerutti
On Jan 18, 2008 12:33 PM, Zbigniew Braniecki <[EMAIL PROTECTED]> wrote: > > class A: > >def __init__ (self, val=[]): > > print val > > self.lst = val > > > > val is created only *once* and shared across all instaces of A. > > Thanks for help guys! > > It's really a nice pitfall, I can

Re: Bug in __init__?

2008-01-18 Thread Fredrik Lundh
Zbigniew Braniecki wrote: > It's really a nice pitfall, I can hardly imagine anyone expecting this, > or how easily could I find this info (e.g. what query should I give to > google to get it without bothering people on this group) looking things up in the documentation *before* deciding that y

Re: Efficient processing of large nuumeric data file

2008-01-18 Thread Tim Chase
> for line in file: The first thing I would try is just doing a for line in file: pass to see how much time is consumed merely by iterating over the file. This should give you a baseline from which you can base your timings > data = line.split() > first = int(data[0]) > >

Re: Perl Template Toolkit: Now in spicy new Python flavor

2008-01-18 Thread [EMAIL PROTECTED]
On Jan 16, 12:01 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > On Jan 15, 1:45 pm, George Sakkis <[EMAIL PROTECTED]> wrote: > > Unless I missed it, the documentation > > covers the Perl version only. > > The online documentation, yes. All source-level documentation (from > which the online

Re: Efficient processing of large nuumeric data file

2008-01-18 Thread Paul Rubin
David Sanders <[EMAIL PROTECTED]> writes: > The data files are large (~100 million lines), and this code takes a > long time to run (compared to just doing wc -l, for example). wc is written in carefully optimized C and will almost certainly run faster than any python program. > Am I doing someth

Re: [python] How to detect a remote webpage is accessible? (in HTTP)

2008-01-18 Thread John Nagle
?? wrote: > Howdy, all, > I want to use python to detect the accessibility of website. > Currently, I use urllib > to obtain the remote webpage, and see whether it fails. But the problem is > that > the webpage may be very large; it takes too long time. Certainly, it > is no need to download

Re: Efficient processing of large nuumeric data file

2008-01-18 Thread Matimus
On Jan 18, 9:15 am, David Sanders <[EMAIL PROTECTED]> wrote: > Hi, > > I am processing large files of numerical data. Each line is either a > single (positive) integer, or a pair of positive integers, where the > second represents the number of times that the first number is > repeated in the data

Re: Efficient processing of large nuumeric data file

2008-01-18 Thread George Sakkis
On Jan 18, 12:15 pm, David Sanders <[EMAIL PROTECTED]> wrote: > Hi, > > I am processing large files of numerical data. Each line is either a > single (positive) integer, or a pair of positive integers, where the > second represents the number of times that the first number is > repeated in the da

Re: Using "pickle" for interprocess communication - some notes and things that ought to be documented.

2008-01-18 Thread John Nagle
John Nagle wrote: > Irmen de Jong wrote: >> Christian Heimes wrote: >>> John Nagle wrote: It's possible to use "pickle" for interprocess communication over pipes, but it's not straightforward. Another "gotcha". The "pickle" module seems to be OK with the translations of "universal n

RE: How to use only a sub shell to execute many commands in python

2008-01-18 Thread Reedick, Andrew
> -Original Message- > From: [EMAIL PROTECTED] [mailto:python- > [EMAIL PROTECTED] On Behalf Of raocheng > Sent: Friday, January 18, 2008 6:31 AM > To: python-list@python.org > Subject: How to use only a sub shell to execute many commands in python > > Please see the following code. > Supp

Re: Bug in __init__?

2008-01-18 Thread Zbigniew Braniecki
Christian Heimes wrote: > Zbigniew Braniecki wrote: >> Any clue on what's going on here, and/if where I should report it? > > Congratulations! You've stumbled over a well known gotcha. Most newbies > fall for the trap. > > class A: >def __init__ (self, val=[]): > print val > self.ls

Re: import from question

2008-01-18 Thread Tobiah
>> Ok, I get it. I was locally importing a pointer to an integer > > Really? What language were you using? Python doesn't have pointers. What term do you prefer? Reference? Object id holder? -- Posted via a free Usenet account from http://www.teranews.com -- http://mail.python.org/mailma

RE: how to resolve Windows pathnames into cygwin ones

2008-01-18 Thread Reedick, Andrew
> -Original Message- > From: [EMAIL PROTECTED] [mailto:python- > [EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] > Sent: Friday, January 18, 2008 11:11 AM > To: python-list@python.org > Subject: how to resolve Windows pathnames into cygwin ones > > I am looking for a function to resolve '

Re: Bug in __init__?

2008-01-18 Thread Martin Blume
"Zbigniew Braniecki" schrieb > I found a bug in my code today, and spent an hour trying to locate it > and then minimize the testcase. > [...] >def __init__ (self, val=[]): > [...] > Any clue on what's going on here, and/if where I should report it? > I think this has to do with http://doc

Re: Bug in __init__?

2008-01-18 Thread Matimus
On Jan 18, 9:09 am, Zbigniew Braniecki <[EMAIL PROTECTED]> wrote: > I found a bug in my code today, and spent an hour trying to locate it > and then minimize the testcase. > > Once I did it, I'm still confused about the behavior and I could not > find any reference to this behavior in docs. > > tes

Re: Bug in __init__?

2008-01-18 Thread Eduardo O. Padoan
On Jan 18, 2008 3:09 PM, Zbigniew Braniecki <[EMAIL PROTECTED]> wrote: > I found a bug in my code today, and spent an hour trying to locate it > and then minimize the testcase. > > Once I did it, I'm still confused about the behavior and I could not > find any reference to this behavior in docs. >

Re: Bug in __init__?

2008-01-18 Thread Christian Heimes
Zbigniew Braniecki wrote: > Any clue on what's going on here, and/if where I should report it? Congratulations! You've stumbled over a well known gotcha. Most newbies fall for the trap. class A: def __init__ (self, val=[]): print val self.lst = val val is created only *once* and sha

Efficient processing of large nuumeric data file

2008-01-18 Thread David Sanders
Hi, I am processing large files of numerical data. Each line is either a single (positive) integer, or a pair of positive integers, where the second represents the number of times that the first number is repeated in the data -- this is to avoid generating huge raw files, since one particular num

Re: how to resolve Windows pathnames into cygwin ones

2008-01-18 Thread apatheticagnostic
On Jan 18, 11:48 am, Grant Edwards <[EMAIL PROTECTED]> wrote: > On 2008-01-18, apatheticagnostic <[EMAIL PROTECTED]> wrote: > > > > > On Jan 18, 11:10 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > >> I am looking for a function to resolve 'F:/foo/bar' into '/cygdrive/f/ > >> foo/bar'. I get

Bug in __init__?

2008-01-18 Thread Zbigniew Braniecki
I found a bug in my code today, and spent an hour trying to locate it and then minimize the testcase. Once I did it, I'm still confused about the behavior and I could not find any reference to this behavior in docs. testcase: class A(): def add (self, el): self.lst.extend(el) def

Re: how to resolve Windows pathnames into cygwin ones

2008-01-18 Thread Grant Edwards
On 2008-01-18, apatheticagnostic <[EMAIL PROTECTED]> wrote: > On Jan 18, 11:10 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: >> I am looking for a function to resolve 'F:/foo/bar' into '/cygdrive/f/ >> foo/bar'. I get the original dirpath from tkFileDialog.askdirectory in >> a Windows form and

Re: plz help how to print python variable using os.system()

2008-01-18 Thread Grant Edwards
On 2008-01-16, Lutz Horn <[EMAIL PROTECTED]> wrote: > Hi, > > On Wed, 16 Jan 2008 05:29:08 -0800 (PST), [EMAIL PROTECTED] said: >> var = "/home/anonymous" >> os.system("echo $var) > > os.system("echo %s" % var) Though one wonders why one would do that instead of simply doing print

Re: How to use only a sub shell to execute many commands in python

2008-01-18 Thread Gabriel Genellina
En Fri, 18 Jan 2008 09:31:25 -0200, raocheng <[EMAIL PROTECTED]> escribi�: > Please see the following code. > Suppose I have many shell commands to be executed. And I don't want to > fork a sub shell for each command(eg: status,output = > commands.getstatusoutput(cmd)) because it is too expensive.

Re: how to resolve Windows pathnames into cygwin ones

2008-01-18 Thread apatheticagnostic
On Jan 18, 11:10 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > I am looking for a function to resolve 'F:/foo/bar' into '/cygdrive/f/ > foo/bar'. I get the original dirpath from tkFileDialog.askdirectory in > a Windows form and none of os.path.* functions seem to resolve it to a > cygwin for

Re: how to resolve Windows pathnames into cygwin ones

2008-01-18 Thread Gerhard Häring
[EMAIL PROTECTED] wrote: > I am looking for a function to resolve 'F:/foo/bar' into '/cygdrive/f/ > foo/bar'. I get the original dirpath from tkFileDialog.askdirectory in > a Windows form and none of os.path.* functions seem to resolve it to a > cygwin form. Rather they _append_ it to the current d

Re: Interesting Thread Gotcha

2008-01-18 Thread Hendrik van Rooyen
"Dan" wrote: > Would it be possible to have pychecker (or some such) warn that there > is an insufficient parameter count to start_new_thread? I guess that > would require knowing the type of thread. . . I think this is the hub of the thing - its not only start_new_thread, but the way that par

how to resolve Windows pathnames into cygwin ones

2008-01-18 Thread [EMAIL PROTECTED]
I am looking for a function to resolve 'F:/foo/bar' into '/cygdrive/f/ foo/bar'. I get the original dirpath from tkFileDialog.askdirectory in a Windows form and none of os.path.* functions seem to resolve it to a cygwin form. Rather they _append_ it to the current directory, resulting at best in a

Re: get the size of a dynamically changing file fast ?

2008-01-18 Thread Mike Driscoll
On Jan 17, 3:56 pm, Stef Mientki <[EMAIL PROTECTED]> wrote: > hello, > > I've a program (not written in Python) that generates a few thousands > bytes per second, > these files are dumped in 2 buffers (files), at in interval time of 50 msec, > the files can be read by another program, to do further

Re: Filtering two files with uncommon column

2008-01-18 Thread Neil Cerutti
On Jan 18, 2008 4:23 AM, Madhur <[EMAIL PROTECTED]> wrote: > I would like to know the best way of generating filter of two files > based upon the following condition As a bit of friendly advice, you'll get much more useful assistance if you post your code. If you don't have any code to show, writ

Re: ANN:proxysocket(socks4,socks5)v0.1

2008-01-18 Thread Samuel
On 1月18日, 下午3时04分, Tim Roberts <[EMAIL PROTECTED]> wrote: > Samuel <[EMAIL PROTECTED]> wrote: > > >http://code.google.com/p/proxysocket/downloads/list > > Allow me to introduce you to the concept of comments. Python allows you to > include descriptive sentences in your program that explain what th

Free amazing softwares and virus protect

2008-01-18 Thread bajagu
H, Free download latest softwares... Hurrryyy upp http://freesoftwaredownloaded.blogspot.com/ http://freedownload.co.in -- http://mail.python.org/mailman/listinfo/python-list

Re: Some Berkeley DB questions (being maintained? queries?)

2008-01-18 Thread Aahz
In article <[EMAIL PROTECTED]>, Terry Jones <[EMAIL PROTECTED]> wrote: > >I'm also interested in any ongoing or planned work on the Python interface. Someone recently volunteered to take over primary maintenance, but I can't find the mailing list post. -- Aahz ([EMAIL PROTECTED]) <*>

Re: array and list

2008-01-18 Thread Paddy
> Paddy: > > > I guess 'under the hood' Python (& Perl?), arrays might be more like > > an implementation of what the C programmer might call a linked list, > > but even then there are differences as most linked list examples > > given in C tutorials are lists of the same type of object, > >

Re: Cannot catch _mysql_exceptions.OperationalError

2008-01-18 Thread Jeffrey Froman
Bob wrote: > Here's the code that did not work: > > import _mysql_exceptions > from _mysql_exceptions import OperationalError > > try: > database_code() > except (_mysql_exceptions.OperationalError, OperationalError), e: > error_handling() Both of the above forms work fine here, as does using M

Re: MySQLdb and compatibility with vista 64 bits

2008-01-18 Thread revuesbio
On 5 jan, 20:00, revuesbio <[EMAIL PROTECTED]> wrote: > Hello, > I try to installmysqldbon windows vista 64bits but there is a > failure when i try to importmysqldbin python 2.5 : > "DLL load failed with error code 193" > > Is there a solution to this problem ? > Thank you is there another solutio

Re: "Code Friendly" Blog?

2008-01-18 Thread Guy Rutenberg
On Jan 18, 8:56 am, Jeroen Ruigrok van der Werven <[EMAIL PROTECTED] nomine.org> wrote: > I personally use a Wordpress installation on my own machine with an additional > plugin for syntax highlighting.http://wordpress.org/extend/plugins/wp-syntax/ > I use the same configuration (Wordpress + wp-s

Re: How to detect a remote webpage is accessible? (in HTTP)

2008-01-18 Thread grflanagan
On Jan 18, 6:22 am, "甜瓜" <[EMAIL PROTECTED]> wrote: > Howdy, all, > I want to use python to detect the accessibility of website. > Currently, I use urllib > to obtain the remote webpage, and see whether it fails. But the problem is > that > the webpage may be very large; it takes too long tim

Re: Filtering two files with uncommon column

2008-01-18 Thread Martin Blume
"Madhur" schrieb > I would like to know the best way of generating filter > of two files based upon the following condition > [...] > Sounds like homework. Here some suggestions: - for each file, create a dictionary (see help(dict) in the python shell for details) and populate it with the values

How to use only a sub shell to execute many commands in python

2008-01-18 Thread raocheng
Please see the following code. Suppose I have many shell commands to be executed. And I don't want to fork a sub shell for each command(eg: status,output = commands.getstatusoutput(cmd)) because it is too expensive. I want to use only one sub shell to execute all these commands and want to get each

Re: Filtering two files with uncommon column

2008-01-18 Thread Chris
On Jan 18, 12:08 pm, Madhur <[EMAIL PROTECTED]> wrote: > On Jan 18, 2:37 pm, Chris <[EMAIL PROTECTED]> wrote: > > > > > On Jan 18, 11:23 am, Madhur <[EMAIL PROTECTED]> wrote: > > > > I would like to know the best way of generating filter of two files > > > based upon the following condition > > > >

Re: XOR encryption

2008-01-18 Thread joe jacob
On Jan 18, 4:11 pm, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > On Fri, 18 Jan 2008 03:06:51 -0800, joe jacob wrote: > > I wrote a python script to perform XOR encryption on a text and write > > the encrypted text to a file. But when I try to read the file as the > > encrypted text contai

Re: XOR encryption

2008-01-18 Thread Marc 'BlackJack' Rintsch
On Fri, 18 Jan 2008 03:06:51 -0800, joe jacob wrote: > I wrote a python script to perform XOR encryption on a text and write > the encrypted text to a file. But when I try to read the file as the > encrypted text contains an EOF in between the file is read only to the > first EOF and remaining par

XOR encryption

2008-01-18 Thread joe jacob
I wrote a python script to perform XOR encryption on a text and write the encrypted text to a file. But when I try to read the file as the encrypted text contains an EOF in between the file is read only to the first EOF and remaining part of the text is not read. I used the text "hello world" and

Re: Filtering two files with uncommon column

2008-01-18 Thread Paul Rubin
Madhur <[EMAIL PROTECTED]> writes: > If the files2 is unordered, then the above logic does not work. How to > takle it? This sounds like a homework problem. Also, you are trying to reimplement the unix "comm" command. -- http://mail.python.org/mailman/listinfo/python-list

Re: Loop in a loop?

2008-01-18 Thread Sacred Heart
On Jan 17, 7:39 pm, Paul Rubin wrote: > Sacred Heart <[EMAIL PROTECTED]> writes: > > array1 = ['one','two','three','four'] > > array2 = ['a','b','c','d'] > > > I want to loop through array1 and add elements from array2 at the end, > > so it looks like this: > > > one a >

Re: Python Tutorial.

2008-01-18 Thread Sacred Heart
On Jan 17, 11:30 pm, Rizwan <[EMAIL PROTECTED]> wrote: > Hiya, > > I found one good website for python tutorial. just thought to share > with community. > > Hope you all also like it.. > > http://python.objectis.net > > -MR Thanks, looks like a nice collection of links. I've bookmarked the page.

Re: Filtering two files with uncommon column

2008-01-18 Thread Madhur
On Jan 18, 2:37 pm, Chris <[EMAIL PROTECTED]> wrote: > On Jan 18, 11:23 am, Madhur <[EMAIL PROTECTED]> wrote: > > > > > I would like to know the best way of generating filter of two files > > based upon the following condition > > > I have two files. Contents of the first file is > > > File 1 > > a

Re: [python] How to detect a remote webpage is accessible? (in HTTP)

2008-01-18 Thread Jarek Zgoda
甜瓜 napisał(a): > Howdy, all, > I want to use python to detect the accessibility of website. > Currently, I use urllib > to obtain the remote webpage, and see whether it fails. But the problem is > that > the webpage may be very large; it takes too long time. Certainly, it > is no need to down

Re: Loop in a loop?

2008-01-18 Thread cokofreedom
> Hehe.. I remember seeing a similar one for Java and "Hello world" > using more and more elaborate abstractions and design patterns but I > can't find the link. > > George This is not linked to Java but deals with Hello World http://www.ariel.com.au/jokes/The_Evolution_of_a_Programmer.html -- h

  1   2   >