Re: Inquiry regarding the name of subprocess.Popen class

2008-09-02 Thread Marc 'BlackJack' Rintsch
On Tue, 02 Sep 2008 19:54:12 -0400, Derek Martin wrote: >> And if they model an action there must be some way to activate the >> action > > That's a reasonable assumption, but as I also said, the object might > just describe the action -- essentially the equivalent of a struct in C. ``struct``\s

Re: Inquiry regarding the name of subprocess.Popen class

2008-09-02 Thread Derek Martin
On Wed, Sep 03, 2008 at 12:20:18AM -0400, Miles wrote: > Derek Martin wrote: > > On Tue, Sep 02, 2008 at 10:55:54PM +, Marc 'BlackJack' Rintsch wrote: > >> but the instances of `Popen` are no actions. There's no way to > >> "execute" a `Popen` instance. > > > > Yes there is... you execute it w

Re: Inquiry regarding the name of subprocess.Popen class

2008-09-02 Thread Marc 'BlackJack' Rintsch
On Wed, 03 Sep 2008 01:23:47 -0400, Derek Martin wrote: > On Wed, Sep 03, 2008 at 12:20:18AM -0400, Miles wrote: >> The subprocess module is also supposed to replace os.system and >> os.spawn*, neither of which involve opening pipes. > > Uh... it's a replacement for os.popen(), which -- guess wha

Re: converting a sed / grep / awk / . . . bash pipe line into python

2008-09-02 Thread Paul McGuire
On Sep 2, 12:36 pm, hofer <[EMAIL PROTECTED]> wrote: > Hi, > > Something I have to do very often is filtering / transforming line > based file contents and storing the result in an array or a > dictionary. > > Very often the functionallity exists already in form of a shell script > with sed / awk /

Re: Is try-except slow?

2008-09-02 Thread Steven D'Aprano
On Tue, 02 Sep 2008 18:56:48 -0500, Robert Kern wrote: > ssecorp wrote: >> or why does this take so god damn long time? > > Several reasons. One of which is that try: except: is slow. I beg to differ. Setting up a try...except block is very fast. Here's an example in Python 2.5: >>> from tim

Re: Inquiry regarding the name of subprocess.Popen class

2008-09-02 Thread Derek Martin
On Wed, Sep 03, 2008 at 12:20:18AM -0400, Miles wrote: > Derek Martin wrote: > > On Tue, Sep 02, 2008 at 10:55:54PM +, Marc 'BlackJack' Rintsch wrote: > >> but the instances of `Popen` are no actions. There's no way to > >> "execute" a `Popen` instance. > > > > Yes there is... you execute it w

Re: pyparsing: match empty line

2008-09-02 Thread Paul McGuire
On Sep 2, 11:38 am, Marek Kubica <[EMAIL PROTECTED]> wrote: > Hi, > > I am trying to get this stuff working, but I still fail. > > I have a format which consists of three elements: > \d{4}M?-\d (4 numbers, optional M, dash, another number) > EMPTY (the token) > [Empty line] (the token. The line m

Re: Pass same parameter in Recursive function

2008-09-02 Thread Davy
On Sep 3, 11:57 am, "Chris Rebert" <[EMAIL PROTECTED]> wrote: > Assuming the function is tail-recursive or the "unchanging" arguments > are immutable, just use a closure: [SNIP] Hi Chris, Thank you :) Perhaps I should clarify the problem. 1. the function is NOT tail-recursive 2. Yes, the arguments

Re: Inquiry regarding the name of subprocess.Popen class

2008-09-02 Thread Miles
Derek Martin wrote: > On Tue, Sep 02, 2008 at 10:55:54PM +, Marc 'BlackJack' Rintsch wrote: >> but the instances of `Popen` are no actions. There's no way to >> "execute" a `Popen` instance. > > Yes there is... you execute it when you instantiate the object. At > the time of instantiation, yo

Re: Pass same parameter in Recursive function

2008-09-02 Thread Chris Rebert
Assuming the function is tail-recursive or the "unchanging" arguments are immutable, just use a closure: def func(self, x, y, A, B, C): def _func(x,y): return _func(g(A,B,C,x), h(A,B,C,y)) #recurse return _func(x, y) I'm unsure as to the performance impact of this though. - Chris

Re: Library/project for making an invitation-only website?

2008-09-02 Thread Eric Wertman
I think Drupy is best library for these task. On Tue, Sep 2, 2008 at 12:27 PM, Dani <[EMAIL PROTECTED]> wrote: > Hi. > > I want to create a website where new users need to be invited by an existing > user in order to open an account. Think of it the way Orkut became popular. > > I need a library

Re: MoinMoin: trouble after install

2008-09-02 Thread alex23
On Sep 3, 9:16 am, "John [H2O]" <[EMAIL PROTECTED]> wrote: > I've installed MoinMoin easily enough, but i have two problems now. This is more of a MoinMoin issue than a Python one. You'll find a lot more support through the MoinMoin site: http://moinmo.in/ Especially: http://moinmo.in/MoinMoinQ

Pass same parameter in Recursive function

2008-09-02 Thread Davy
Hi all, Sometimes I need to pass same parameter in recursive function. From my point of view, the style is redundant, and I don't what to use some global style like self.A, self.B, Is there any other choice? For example, def func(self, x, y, A, B, C): #x, y change in recursive call #A, B, C

Re: Numeric literal syntax

2008-09-02 Thread Ben Finney
Ben Finney <[EMAIL PROTECTED]> writes: > I don't see any good reason (other than your familiarity with the D > language) to use underscores for this purpose, and much more reason > (readability, consistency, fewer arbitrary differences in syntax, > perhaps simpler implementation) to use whitespace

pyArkansas on October 4th

2008-09-02 Thread Greg Lindstrom
We are pleased to announce that pyArkansas will be held on the campus of University of Central Arkansas (www.uca.edu) on October 4th. Scheduled classes in the morning include Python 101 taught by Dr. Bernard Chen (incoming faculty at UCA but having taught the course at Georgia State University),

Re: Py 2.6 changes

2008-09-02 Thread Chris Rebert
On Mon, Sep 1, 2008 at 6:02 PM, Mensanator <[EMAIL PROTECTED]> wrote: > On Sep 1, 6:55�pm, [EMAIL PROTECTED] wrote: >> Steven D'Aprano: >> >> > productory() -- I don't know that function, and googling mostly comes up >> > with retail product searches. Do you mean product(), >> >> Darn my English, y

Re: about downloading the selected information

2008-09-02 Thread woaibeiyang
Thanks a lot! "woaibeiyang" <[EMAIL PROTECTED]> дÈëÏûÏ¢ÐÂÎÅ:[EMAIL PROTECTED] >I have a problem to download the information from url >http://www.ncbi.nlm.nih.gov/sites/entrez. Because it is impossible for me >to add searching material to the url to construct a new url and then visit >the websit

python - mechanize/browser/POST issue

2008-09-02 Thread bruce
evening... using mechanize/Browser, i can easily do a url/get, and process submitting a form that uses a GET as the action. however, I'm not quite sure how to implement the submittal of a form, that uses the POST action. Anyone have a short chunk of code that I can observer, that uses the mechani

Re: Inquiry regarding the name of subprocess.Popen class

2008-09-02 Thread Terry Reedy
Derek Martin wrote: On Tue, Sep 02, 2008 at 10:55:54PM +, Marc 'BlackJack' Rintsch wrote: It's a way more self explaining name, even for people who know the `popen()` function I, and apparently the maintainers (at least at the time they added this thing) don't agree. In fact I thin

Re: Numeric literal syntax (was: Py 2.6 changes)

2008-09-02 Thread Patrick Maupin
On Sep 2, 6:35 am, Nick Craig-Wood <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > >  It's not just my familiarity, Ada language too uses underscore for > >  that purpose, I think, so there's a precedent, and Ada is a language > >  designed to always minimize programmin

Library/project for making an invitation-only website?

2008-09-02 Thread Dani
Hi. I want to create a website where new users need to be invited by an existing user in order to open an account. Think of it the way Orkut became popular. I need a library, or code from some project, that sends the invitations, keeps track of which user invited who, etc. I'm sure there's al

Re: Tkinter popup menu

2008-09-02 Thread Chuckk Hubbard
On Thu, Aug 28, 2008 at 3:50 AM, Carl <[EMAIL PROTECTED]> wrote: > "Chuckk Hubbard" <[EMAIL PROTECTED]> writes: > >> Right-click popup menu. None of the options that come from the >> cascades can be selected with the mouse. If you select a submenu with >> the mouse and then use the arrow keys and

help to use "zc.sourcerelease "

2008-09-02 Thread daniel jeem
Hello every body, I want to use "zc.sourcerelease " for creating pakage. But I'm blocked because I have'nt understand how to use it. Then if you have some link or tutorial, share it for me. Help please. Thanks in advance. -- http://mail.python.org/mailman/listinfo/python-list

Re: Is try-except slow?

2008-09-02 Thread John Machin
On Sep 3, 11:14 am, process <[EMAIL PROTECTED]> wrote: > is this faster btw? Time it and see. > I guess big doesn't help, it's only retrieved once > anyway? Correct. > But is rows retrieved in every loop? Of course. Read your own code! The point is that retrieving the list referenced by "rows"

Re: Is try-except slow?

2008-09-02 Thread John Machin
On Sep 3, 11:00 am, process <[EMAIL PROTECTED]> wrote: > how could I do getpixel once when x and y s changing? I was not referring to *calling* im.getpixel, I was referring to looking up getpixel as an attribute of im. How? See below. > > anyway I rewrote and saw I did a lot of stupid stuff. this

Re: Is try-except slow?

2008-09-02 Thread process
is this faster btw? I guess big doesn't help, it's only retrieved once anyway? But is rows retrieved in every loop? the python interpreter aint too smart? def getPixels(fileName): im = PIL.Image.open(fileName) colors = [] r, c = im.size big = range(0, c) rows = range(0, r)

Re: Is try-except slow?

2008-09-02 Thread process
On Sep 3, 2:36 am, John Machin <[EMAIL PROTECTED]> wrote: > On Sep 3, 9:44 am, ssecorp <[EMAIL PROTECTED]> wrote: > > > or why does this take so god damn long time? > > Because your code does so many god damn unnecessary things. Apart from > the fact (as pointed out already by Robert) that you are

Re: Storing Subprocess Results

2008-09-02 Thread topazcode
On Sep 2, 6:31 pm, Karthik Gurusamy <[EMAIL PROTECTED]> wrote: > On Sep 2, 7:16 am, topazcode <[EMAIL PROTECTED]> wrote: > > > I am using the subprocess module to run some shell commands on a Linux > > system: > > > import subprocess > > output = subprocess.call('''ssh server1 "uptime"''', shell=Tr

Re: Is try-except slow?

2008-09-02 Thread John Machin
On Sep 3, 9:44 am, ssecorp <[EMAIL PROTECTED]> wrote: > or why does this take so god damn long time? Because your code does so many god damn unnecessary things. Apart from the fact (as pointed out already by Robert) that you are needlessly finding the sizes (Y, X) that are already available: (1)

Re: Is try-except slow?

2008-09-02 Thread Robert Kern
ssecorp wrote: or why does this take so god damn long time? Several reasons. One of which is that try: except: is slow. and if I run into an IndexError it break out of the inner loop right? so having range up to 1000 or 1000 wouldn't matter if biggest working x is 800? try: except: need

Re: Numeric literal syntax

2008-09-02 Thread Ben Finney
Peter Pearson <[EMAIL PROTECTED]> writes: > I thought I was a geek, for the past 40 years; but maybe its time > for me to be demoted to the dad on whose bookshelf you'll find that > old book. Once a geek, always a geek. You either stay sharp or get sloppy, but you never stop being a geek :-) --

Re: Inquiry regarding the name of subprocess.Popen class

2008-09-02 Thread Derek Martin
On Tue, Sep 02, 2008 at 10:55:54PM +, Marc 'BlackJack' Rintsch wrote: > On Tue, 02 Sep 2008 18:15:07 -0400, Derek Martin wrote: > > >> Classes represent "things", and class names should be nouns. > > > > Is that a law? > > It's a common guideline. Right. It's a guideline. > > Classes are

Is try-except slow?

2008-09-02 Thread ssecorp
or why does this take so god damn long time? and if I run into an IndexError it break out of the inner loop right? so having range up to 1000 or 1000 wouldn't matter if biggest working x is 800? def getPixels(fileName): im = PIL.Image.open(fileName) colors = [] for y in range(1, 10

MoinMoin: trouble after install

2008-09-02 Thread John [H2O]
I've installed MoinMoin easily enough, but i have two problems now. 1) Some pages, namely the initial FrontPage, fail to load completely 2) It seems after logging in, if I navigate away from the login page, I get logged out immediately. I'm runing 1.13 on Fedora 9 with Apache 2 and ReWrit

Re: Inquiry regarding the name of subprocess.Popen class

2008-09-02 Thread Marc 'BlackJack' Rintsch
On Tue, 02 Sep 2008 18:15:07 -0400, Derek Martin wrote: >> Classes represent "things", and class names should be nouns. > > Is that a law? It's a common guideline. > Classes are instantiated by invoking their class names as a function > call -- the computing equivalent of a verb. Why then, mus

Re: Changing the (codec) error handler for the stdout/stderr streams in Python 3.0

2008-09-02 Thread Jukka Aho
John Nagle wrote: Python 5 is even stricter. Only ASCII (chars 0..127) can be sent to standard output by default. Python 5? (I guess I haven't been following these things enough...) Well, I would sure hope not. -- znark -- http://mail.python.org/mailman/listinfo/python-list

Re: Storing Subprocess Results

2008-09-02 Thread Karthik Gurusamy
On Sep 2, 7:16 am, topazcode <[EMAIL PROTECTED]> wrote: > I am using the subprocess module to run some shell commands on a Linux > system: > > import subprocess > output = subprocess.call('''ssh server1 "uptime"''', shell=True) > > The above assigns the output variable with a return code, i.e. 0 in

Completely unable to install Python on Windows

2008-09-02 Thread v1p3r
I'm attempting to install Python 2.5.2 (python-2.5.2.amd64.msi) on my Vista SP1 x64 system, but the installer always crashes with a "Windows Installer has stopped working" error after clicking Next on the initial screen. I've tried the following so far: 1. x86 and x64 versions 2. Manually reinsta

Re: Renumbering

2008-09-02 Thread Terry Reedy
Francesco Pietra wrote: Hi; Hi, Let L be a data line I would like to renumber, starting from 1, column 6 (i.e, 428 become 1, 429 becomes 2, etc for a very long list) So you want to subtract 427 from each entry in L[22:26] ATOM 3424 N LEU B 428 143.814 87.271 77.726 1.00115.2

Re: Inquiry regarding the name of subprocess.Popen class

2008-09-02 Thread Derek Martin
On Tue, Sep 02, 2008 at 05:22:51PM -0300, Gabriel Genellina wrote: > > The name popen is an abbreviation of "pipe open" -- the function, and > > the class, open pipes to communicate with another process. What you > > said is correct; however there are numerous other ways to open > > subprocesses.

Python-URL! - weekly Python news and links (Sep 2)

2008-09-02 Thread Gabriel Genellina
QOTW: "Information outlives technology." - Tim Bray http://www.tbray.org/ongoing/When/200x/2003/03/24/XMLisOK, but notice all the offspring of this meme any simple search makes apparent Thoughts about the various forms of the import statement: http://groups.google.co

Re: How to write verbose scripts

2008-09-02 Thread Mensanator
On Sep 2, 4:14 pm, John Machin <[EMAIL PROTECTED]> wrote: > On Sep 3, 3:52 am, Mensanator <[EMAIL PROTECTED]> wrote: > > > On Sep 2, 11:55 am, Steven D'Aprano <[EMAIL PROTECTED] > > > if (p & 1)==1: > > print_evens = True > > else: > > print_evens = False > > if (p & 2)==2: > > pr

Re: Inquiry regarding the name of subprocess.Popen class

2008-09-02 Thread Derek Martin
On Tue, Sep 02, 2008 at 06:47:39PM +, Marc 'BlackJack' Rintsch wrote: > That's why I think the name `Popen` is not so good for it. Because it > does more than `popen()` and if it is called `Subprocess` or just > `Process` then it would be merely an implementation detail, that the > `popen()

Re: Renumbering

2008-09-02 Thread bearophileHUGS
John Machin: > Is this homework? Have you put any effort into trying to write a script > yourself? Etc etc etc You are right, I am sorry -.- Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list

Re: Renumbering

2008-09-02 Thread bearophileHUGS
Francesco Pietra, few notes: - In Python and C item numbering generally starts from 0, so you talk about column 0, 1, etc. - You can also use the Italian Python newsgroup if know Italian. - The number of lines with a particular number doesn't seem important to solve your problem. - You don't need t

Re: Inquiry regarding the name of subprocess.Popen class

2008-09-02 Thread Terry Reedy
Gabriel Genellina wrote: Classes represent "things", and class names should be nouns. Functions represent "actions", and their names should be verbs. popen is a good name for a function; Popen is a bad name for a class. People who don't like Popen should have made this argument when subproces

Re: Renumbering

2008-09-02 Thread John Machin
On Sep 3, 6:57 am, "Francesco Pietra" <[EMAIL PROTECTED]> wrote: > Hi; > > I would like to renumber, starting from 1, column 6 (i.e, 428 become > 1, 429 becomes 2, etc for a very long list) > > ATOM 3424 N LEU B 428 143.814 87.271 77.726 1.00115.20 > 2SG3426 [snip] > ATOM 3437

Re: How to write verbose scripts

2008-09-02 Thread John Machin
On Sep 3, 3:52 am, Mensanator <[EMAIL PROTECTED]> wrote: > On Sep 2, 11:55 am, Steven D'Aprano <[EMAIL PROTECTED] > > if (p & 1)==1: > print_evens = True > else: > print_evens = False > if (p & 2)==2: > print_odds = True > else: > print_odds = False > if (p & 4)==4: >

Re: Numpy/Scipy set field of matrix?

2008-09-02 Thread Marc 'BlackJack' Rintsch
On Tue, 02 Sep 2008 13:27:06 -0700, cnb wrote: m > matrix([[1, 2, 3], > [4, 5, 6], > [7, 8, 9]]) > > how do I set the field 1,2 (=6) to 45 for example? > > > and how do I initialize a matrix and then add values in a for-loop? > > Im using PIL and want to store all the pixe

Re: [cairo] Rendering SVG with libRSVG,Python ... CTYPES SUCCESS AT LAST!!!

2008-09-02 Thread Tim Grove
Thanks for your advice Gerdus, but I have tried your suggestion with no success. It has at least been beneficial to discover a tool which I did not know about in 'Dependency Walker'; all dependencies appear okay. HOWEVER (!!!) I HAVE JUST HAD SUCCESS IN LOADING THE DLL !!! In searching through

Renumbering

2008-09-02 Thread Francesco Pietra
Hi; I would like to renumber, starting from 1, column 6 (i.e, 428 become 1, 429 becomes 2, etc for a very long list) ATOM 3424 N LEU B 428 143.814 87.271 77.726 1.00115.20 2SG3426 ATOM 3425 CA LEU B 428 142.918 87.524 78.875 1.00115.20 2SG3427 ATOM 3426 CB L

Re: How to write verbose scripts

2008-09-02 Thread MRAB
On Sep 2, 5:55 pm, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > I find myself writing command line tools in Python where I wish to > include "verbose" output to stdout. > > I start with a helper function: > > def print_(obj, level=0): >     if _verbosity >= level: >         print

Re: synthetic properties

2008-09-02 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : I'm trying to come up with solution for adding synthetic properties to python, similar to synthetic properties in Objective-C. Please explain what Objective-C "synthetic properties" are - not everyone here has a strong Objective-C background... I'm playing around

Re: Numeric literal syntax

2008-09-02 Thread Christian Heimes
Fredrik Lundh wrote: Peter Pearson wrote: (startled noises) It is a delight to find a reference to that half-century-old essay (High Finance) by the wonderful C. Northcote Parkinson, but how many readers will catch the allusion? anyone that's been involved in open source on the development si

Re: synthetic properties

2008-09-02 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: I'm trying to come up with solution for adding synthetic properties to python, similar to synthetic properties in Objective-C. I'm playing around with doing this in a MetaClass. I can dynamically create the attributes that will back the property, but I'm having troubl

Numpy/Scipy set field of matrix?

2008-09-02 Thread cnb
, 'argmax', 'argmin', 'argsort', 'astype', 'base', 'byteswap', 'choose', 'clip', 'compress', 'conj', 'conjugate', 'copy', 'ctypes', 'cumprod', 'cumsum', 'data', 'diagonal', 'dtype', 'dump', 'dumps', 'fill', 'flags', 'flat', 'flatten', 'getA', 'getA1', 'getH', 'getI', 'getT', 'getfield', 'imag', 'it

Re: Inquiry regarding the name of subprocess.Popen class

2008-09-02 Thread Gabriel Genellina
En Tue, 02 Sep 2008 12:39:09 -0300, Derek Martin <[EMAIL PROTECTED]> escribió: > On Tue, Sep 02, 2008 at 01:57:26PM +, Marc 'BlackJack' Rintsch wrote: >> > I would argue that they don't represent processes at all; the object is >> > a set of files which connect the standard I/O streams of a su

Re: configure kdevelop for python

2008-09-02 Thread David Boddie
On Sunday 31 August 2008 10:29, Sindhu wrote: > am a newbie to python language and kdevelop, so i would like to know > how to configure kdevelop for python programming? complete with a > debugger? Maybe asking on the kdevelop mailing list will yield a helpful answer: http://lists.kde.org/?l=kdev

Re: email.Message problem

2008-09-02 Thread Gabriel Genellina
En Tue, 02 Sep 2008 13:04:18 -0300, Corrado Gioannini <[EMAIL PROTECTED]> escribió: > Hi all, > i know i'm probably going to ask a very silly question, but i > can't figure out where i'm doing wrong just reading the docs. > > trying to build and send a mail message using the email.* modules > (wi

synthetic properties

2008-09-02 Thread rowland
I'm trying to come up with solution for adding synthetic properties to python, similar to synthetic properties in Objective-C. I'm playing around with doing this in a MetaClass. I can dynamically create the attributes that will back the property, but I'm having trouble figuring out how to dynamic

Re: What is module initialization?

2008-09-02 Thread dudeja . rajat
On Tue, Sep 2, 2008 at 6:22 PM, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > >>> # myglobals.py: >>> answer = 42 >>> >>> # question.py >>> import myglobals >>> myglobals.answer = "WTF ?" >>> >> >> But if I do :- >> #question.py >> from myglobals import * >> myglobals.answer

Re: about downloading the selected information

2008-09-02 Thread Gabriel Genellina
En Tue, 02 Sep 2008 09:47:46 -0300, woaibeiyang <[EMAIL PROTECTED]> escribió: > I have a problem to download the information from url > http://www.ncbi.nlm.nih.gov/sites/entrez. Because it is impossible for me to > add searching material to the url to construct a new url and then visit the > websi

Re: How to write verbose scripts

2008-09-02 Thread Diez B. Roggisch
Steven D'Aprano schrieb: I find myself writing command line tools in Python where I wish to include "verbose" output to stdout. I start with a helper function: def print_(obj, level=0): if _verbosity >= level: print obj And then I end up with functions or methods looking like th

Re: Numeric literal syntax

2008-09-02 Thread Peter Pearson
On Tue, 02 Sep 2008 17:18:58 GMT, Alan G Isaac <[EMAIL PROTECTED]> wrote: >> On 02 Sep 2008 06:10:51 GMT, Steven D'Aprano wrote: >>> At the risk of bike-shedding, >> [snip] > > Peter Pearson wrote: >> (startled noises) It is a delight to find a reference to >> that half-century-old essay (High Fin

Re: Large amount of files to parse/organize, tips on algorithm?

2008-09-02 Thread jay graves
On Sep 2, 1:02 pm, cnb <[EMAIL PROTECTED]> wrote: > over 17000 files... > > netflixprize. http://wiki.python.org/moin/NetflixPrizeBOF specifically: http://pyflix.python-hosting.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Inquiry regarding the name of subprocess.Popen class

2008-09-02 Thread Marc 'BlackJack' Rintsch
On Tue, 02 Sep 2008 11:39:09 -0400, Derek Martin wrote: > On Tue, Sep 02, 2008 at 01:57:26PM +, Marc 'BlackJack' Rintsch > wrote: >> > I would argue that they don't represent processes at all; the object >> > is a set of files which connect the standard I/O streams of a >> > subprocess to its

Re: source for the property function

2008-09-02 Thread Bruno Desthuilliers
Rowland Smith a écrit : Anyone know where the source code for the built-in property function Actually, it's a class, not a function. is located in a python distribution? property being a builtin type, you should find it somewhere in the CPython's C source AFAICT. I would like to see how

rope class (heavyweight string)

2008-09-02 Thread castironpi
Does anyone want to talk about a Rope implementation in Python? It doesn't get faster than the native strings until about 2 megs. P.S. Didn't your momma ever tell you not to talk on newsgroups? -- http://mail.python.org/mailman/listinfo/python-list

Re: Large amount of files to parse/organize, tips on algorithm?

2008-09-02 Thread Paul Rubin
cnb <[EMAIL PROTECTED]> writes: > For each file I construct a list of reviews and then for each new file > I merge the reviews so that in the end have a list of reviewers and > for each reviewer all their reviews. > > What is the fastest way to do this? Scan through all the files sequentially, em

Re: converting a sed / grep / awk / . . . bash pipe line into python

2008-09-02 Thread Marc 'BlackJack' Rintsch
On Tue, 02 Sep 2008 10:36:50 -0700, hofer wrote: > sed 's/\.\..*//' \### remove '//' comments | sed 's/#.*//' Comment does not match the code. Or vice versa. :-) Untested: from __future__ import with_statement from itertools import ifilter, ifilterfalse, imap def is_junk(line): line

Re: Large amount of files to parse/organize, tips on algorithm?

2008-09-02 Thread Eric Wertman
I think you really want use a relational database of some sort for this. On Tue, Sep 2, 2008 at 2:02 PM, cnb <[EMAIL PROTECTED]> wrote: > over 17000 files... > > netflixprize. > -- > http://mail.python.org/mailman/listinfo/python-list > -- http://mail.python.org/mailman/listinfo/python-list

Re: How do I adjust the font size on IDLE when running on Mac OS 10.5.4? TIA.

2008-09-02 Thread Chris Rebert
Same as on all the other platforms. 1. Open IDLE 2. Go Options -> Configure IDLE... 3. Choose the Fonts/Tabs section 4. Use the Size pulldown box - Chris On Tue, Sep 2, 2008 at 6:26 AM, Malcolm Lewis <[EMAIL PROTECTED]> wrote: > > > -- > http://mail.python.org/mailman/listinfo/python-list > -

Re: Large amount of files to parse/organize, tips on algorithm?

2008-09-02 Thread cnb
over 17000 files... netflixprize. -- http://mail.python.org/mailman/listinfo/python-list

Re: Large amount of files to parse/organize, tips on algorithm?

2008-09-02 Thread cnb
On Sep 2, 7:06 pm, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Tue, 02 Sep 2008 09:48:32 -0700, cnb wrote: > > I have a bunch of files consisting of moviereviews. > > > For each file I construct a list of reviews and then for each new file I > > merge the reviews so that in t

Re: How to write verbose scripts

2008-09-02 Thread Mensanator
On Sep 2, 11:55 am, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > I find myself writing command line tools in Python where I wish to > include "verbose" output to stdout. > > I start with a helper function: > > def print_(obj, level=0): > if _verbosity >= level: > prin

Re: (in memory) database

2008-09-02 Thread Paul Boddie
On 2 Sep, 17:38, Zentrader <[EMAIL PROTECTED]> wrote: > > I don't understand why Cameron has a different version of Python which > > doesn't seem to have sqlite support enabled. > > Agreed, but won't the package manager tell him if python-sqlite is > installed? It shouldn't need to be installed: t

Re: Relative imports and "import X as Y"

2008-09-02 Thread OKB (not okblacke)
Gabriel Genellina wrote: > En Sun, 31 Aug 2008 07:27:12 -0300, Wojtek Walczak > <[EMAIL PROTECTED]> escribió: > >> On Sun, 31 Aug 2008 06:40:35 GMT, OKB (not okblacke) wrote: >> Download the latest beta for your system and give it a try. >>> >>> Thanks for the advice, but I'd reall

Problems when working with different timezones

2008-09-02 Thread ocgstyles
Here's some Python code executed on Red Hat 3.4 web server located in Mountain time (MDT). You'll notice that the time after setting the timezone to Eastern time (EST), the time is incorrectly 6 hours ahead, when it should only be 3. Python 2.5 (r25:51908, Mar 23 2007, 14:22:20) [GCC 3.4.6 200604

converting a sed / grep / awk / . . . bash pipe line into python

2008-09-02 Thread hofer
Hi, Something I have to do very often is filtering / transforming line based file contents and storing the result in an array or a dictionary. Very often the functionallity exists already in form of a shell script with sed / awk / grep , . . . and I would like to have the same implementation in m

Re: source for the property function

2008-09-02 Thread Christian Heimes
Rowland Smith wrote: Anyone know where the source code for the built-in property function is located in a python distribution? I would like to see how it works - mainly, how does it know which class it is being called from? Property is not a function but a type. Properties are a common usage

Re: Numeric literal syntax

2008-09-02 Thread Fredrik Lundh
Peter Pearson wrote: (startled noises) It is a delight to find a reference to that half-century-old essay (High Finance) by the wonderful C. Northcote Parkinson, but how many readers will catch the allusion? anyone that's been involved in open source on the development side for more than, say

Re: What is module initialization?

2008-09-02 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: # myglobals.py: answer = 42 # question.py import myglobals myglobals.answer = "WTF ?" But if I do :- #question.py from myglobals import * myglobals.answer = "WTF ?" will this work? with the above definition of myglobals, no. "from myglobals import" doesn't add t

Re: Numeric literal syntax

2008-09-02 Thread Alan G Isaac
On 02 Sep 2008 06:10:51 GMT, Steven D'Aprano wrote: At the risk of bike-shedding, [snip] Peter Pearson wrote: (startled noises) It is a delight to find a reference to that half-century-old essay (High Finance) by the wonderful C. Northcote Parkinson, but how many readers will catch the allus

Re: (in memory) database

2008-09-02 Thread Peter Otten
Zentrader wrote: >> I don't understand why Cameron has a different version of Python which >> doesn't seem to have sqlite support enabled. > > Agreed, but won't the package manager tell him if python-sqlite is > installed? That would be the next step since it appears that SQLite > intself is alr

Re: Large amount of files to parse/organize, tips on algorithm?

2008-09-02 Thread Steven D'Aprano
On Tue, 02 Sep 2008 09:48:32 -0700, cnb wrote: > I have a bunch of files consisting of moviereviews. > > For each file I construct a list of reviews and then for each new file I > merge the reviews so that in the end have a list of reviewers and for > each reviewer all their reviews. > > What is

Re: How to write verbose scripts

2008-09-02 Thread Joe Riopel
On Tue, Sep 2, 2008 at 12:55 PM, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > Is there a better way of doing this than the way I am going about it? Would the logging module help, and just print the output to the stdout (or a file) instead? -- http://mail.python.org/mailman/listinfo/python-list

How to write verbose scripts

2008-09-02 Thread Steven D'Aprano
I find myself writing command line tools in Python where I wish to include "verbose" output to stdout. I start with a helper function: def print_(obj, level=0): if _verbosity >= level: print obj And then I end up with functions or methods looking like this: def parrot(x) pri

Re: Changing the (codec) error handler for the stdout/stderr streams in Python 3.0

2008-09-02 Thread Steven D'Aprano
On Tue, 02 Sep 2008 09:57:05 -0700, John Nagle wrote: > Jukka Aho wrote: >> Just a tip for those who are only just cutting their teeth on Python >> 3.0 and might have encountered the same problem as I did: >> >> When a Python (3.x) program is run on a terminal that only supports a >> legacy chara

Re: source for the property function

2008-09-02 Thread Diez B. Roggisch
Rowland Smith schrieb: Anyone know where the source code for the built-in property function is located in a python distribution? I would like to see how it works - mainly, how does it know which class it is being called from? Google the "descriptor protocol" for new-style classes. That expl

Large amount of files to parse/organize, tips on algorithm?

2008-09-02 Thread cnb
I have a bunch of files consisting of moviereviews. For each file I construct a list of reviews and then for each new file I merge the reviews so that in the end have a list of reviewers and for each reviewer all their reviews. What is the fastest way to do this? 1. Create one file with reviews,

pyparsing: match empty line

2008-09-02 Thread Marek Kubica
Hi, I am trying to get this stuff working, but I still fail. I have a format which consists of three elements: \d{4}M?-\d (4 numbers, optional M, dash, another number) EMPTY (the token) [Empty line] (the token. The line may contain whitespaces, but nothing else) While the ``watchname`` and ``

Re: Changing the (codec) error handler for the stdout/stderr streams in Python 3.0

2008-09-02 Thread John Nagle
Jukka Aho wrote: Just a tip for those who are only just cutting their teeth on Python 3.0 and might have encountered the same problem as I did: When a Python (3.x) program is run on a terminal that only supports a legacy character encoding - such as Latin 1 or Codepage 437 - all characters pr

email.Message problem

2008-09-02 Thread Corrado Gioannini
Hi all, i know i'm probably going to ask a very silly question, but i can't figure out where i'm doing wrong just reading the docs. trying to build and send a mail message using the email.* modules (with python 2.5). a simplified version of my script that breaks is this: mailtest.py

Re: Numeric literal syntax (was: Py 2.6 changes)

2008-09-02 Thread Peter Pearson
On 02 Sep 2008 06:10:51 GMT, Steven D'Aprano wrote: > At the risk of bike-shedding, [snip] (startled noises) It is a delight to find a reference to that half-century-old essay (High Finance) by the wonderful C. Northcote Parkinson, but how many readers will catch the allusion? -- To email me, s

source for the property function

2008-09-02 Thread Rowland Smith
Anyone know where the source code for the built-in property function is located in a python distribution? I would like to see how it works - mainly, how does it know which class it is being called from? Thanks, Rowland -- http://mail.python.org/mailman/listinfo/python-list

Re: [ctypes-users] ctypes - loading 'librsvg-2-2.dll'

2008-09-02 Thread Tim Grove
Thanks Martin (and others) for your advice. No, this solution didn't quite work either. Well, the extremely annoying thing is that it DOES work on another home pc, but on my laptop which I use for work, it doesn't want to know!!! Both are running WinXP Pro. All the dependencies and paths "seem"

Re: dict.update

2008-09-02 Thread Tino Wildenhain
Mike P wrote: Hi All, I have two dictionaries e.g dict1 = {123:3,234:5,456:3} dict2 = {123:4,157:2,234:5,456:3,567:2} I want to merge these two dictionaries together so i have a resultant dictionary of: dict3 = {123:[4,3],157:[2,0],234:[5,5],456:[3,3],567:[2,0]} As later on i want to write a

Re: (in memory) database

2008-09-02 Thread Zentrader
> I don't understand why Cameron has a different version of Python which > doesn't seem to have sqlite support enabled. Agreed, but won't the package manager tell him if python-sqlite is installed? That would be the next step since it appears that SQLite intself is already installed. Since Ubunt

Re: Tkinter: tkButtonDown, tkButtonEnter, tkButtonInvoke, tkButtonLeave, tkButtonUp

2008-09-02 Thread akineko
On Sep 2, 5:46 am, "Guilherme Polo" <[EMAIL PROTECTED]> wrote: > Did you even try creating a checkbutton with indicatoron=False ? You > could get surprised. I didn't. My perception of checkbutton was a button with a check. So, I tried as you suggested. Yes, you are right. It is almost what I wante

Re: Inquiry regarding the name of subprocess.Popen class

2008-09-02 Thread Derek Martin
On Tue, Sep 02, 2008 at 01:57:26PM +, Marc 'BlackJack' Rintsch wrote: > > I would argue that they don't represent processes at all; the object is > > a set of files which connect the standard I/O streams of a subprocess to > > its parent, and methods to operate on those files. > > And the proc

  1   2   >