Right tool and method to strip off html files (python, sed, awk?)

2007-07-13 Thread sebzzz
Hi, I'm in the process of refactoring a lot of HTML documents and I'm using html tidy to do a part of this work. (clean up, change to xhtml and remove font and center tags) Now, Tidy will just do a part of the work I need to do, I have to remove all the presentational tags and attributes from the

Re: Numpy array index handling

2007-07-13 Thread Robert Kern
[EMAIL PROTECTED] wrote: > Being a Matlab user wanting to switch to Python/SciPy, Fantastic! You might be interested in joining the numpy mailing list. There are a lot more of us numpy devs and users there than here. http://www.scipy.org/Mailing_Lists > I'd like to > know how the following Mat

Pass by reference or by value?

2007-07-13 Thread Robert Dailey
Hi, I noticed in Python all function parameters seem to be passed by reference. This means that when I modify the value of a variable of a function, the value of the variable externally from the function is also modified. Sometimes I wish to work with "copies", in that when I pass in an integer v

Re: A Python newbie ask a simple question

2007-07-13 Thread Christoph Haas
On Fri, Jul 13, 2007 at 06:35:16PM -, [EMAIL PROTECTED] wrote: > what does the statement "choice = raw_input(prompt)[0]" mean? I don't > know why there is a '[0]' in the statement. It calls the "raw_input" function with the argument of "prompt". That function returns a list and you are getting

Re: Pass by reference or by value?

2007-07-13 Thread Robert Dailey
On Jul 13, 2:10 pm, Robert Dailey <[EMAIL PROTECTED]> wrote: > Hi, > > I noticed in Python all function parameters seem to be passed by > reference. This means that when I modify the value of a variable of a > function, the value of the variable externally from the function is > also modified. > >

Re: Can a low-level programmer learn OOP?

2007-07-13 Thread Cousin Stanley
> > 2. Must be cross-platform: Linux + Windows. > > This factor can have a big impact on whether it is necessary > to learn a new language, or stick with C. > > If my platform was only Linux I could just learn GTK > and be done with it. > Chris The Python bindings for

www.cerocom.com

2007-07-13 Thread Natalia
.. www.cerocom.com .. You will be able to ask yourself: Is Internet a good investment for my company? So that an investment would have to do I of this type? Really is going to serve to me to have a Web site? So that to be in I

Re: Pass by reference or by value?

2007-07-13 Thread James Stroud
Robert Dailey wrote: > Hi, > > I noticed in Python all function parameters seem to be passed by > reference. This means that when I modify the value of a variable of a > function, the value of the variable externally from the function is > also modified. > > Sometimes I wish to work with "copies"

Re: Can a low-level programmer learn OOP?

2007-07-13 Thread Neil Cerutti
On 2007-07-13, Chris Carlen <[EMAIL PROTECTED]> wrote: > John Nagle wrote: >> You can sometimes get better performance in C++ than in C, >> because C++ has "inline". Inline expansion happens before >> optimization, so you can have abstractions that cost nothing. > > That's interesting. But why is

Re: 2**2**2**2**2 wrong? Bug?

2007-07-13 Thread Wayne Brehaut
On Wed, 11 Jul 2007 21:37:00 -0400, "Terry Reedy" <[EMAIL PROTECTED]> wrote: > >"Evan Klitzke" <[EMAIL PROTECTED]> wrote in message >news:[EMAIL PROTECTED] >| On 7/11/07, Gabriel Genellina <[EMAIL PROTECTED]> wrote: >| > Just for curiosity: This helps to find the answer to the problem "Which >is

Re: Pass by reference or by value?

2007-07-13 Thread James Stroud
Robert Dailey wrote: > I actually want to know how to "pass by > reference", in that any changes made to a parameter inside of a > function also changes the variable passed in. Pass a mutable type. py> class C(object): ... def __repr__(self): ... return str(self.value) ... def __init__(se

Re: 2**2**2**2**2 wrong? Bug?

2007-07-13 Thread Wayne Brehaut
On Fri, 13 Jul 2007 11:30:16 -0700, Paul McGuire <[EMAIL PROTECTED]> wrote: >On Jul 13, 1:20 pm, Wayne Brehaut <[EMAIL PROTECTED]> wrote: >> On Mon, 09 Jul 2007 23:51:25 -0700, "[EMAIL PROTECTED]" >> >> >> >> >> >> <[EMAIL PROTECTED]> wrote: >> >On Jul 9, 11:42?pm, Paul McGuire <[EMAIL PROTECTED]>

help reading cookie values

2007-07-13 Thread Sean
I am trying to read a cookie I set but I am not sure if I really set it correctly or I am not reading it correctly. I was given the following instructions to set the cookie. It appears to be working because in Firefox browser I see the cookie listed for my domain > you set a cookie in a pythonsc

Re: Numpy array index handling

2007-07-13 Thread sturlamolden
>>> from numpy import * >>> from numpy.random import * >>> N = 100 >>> input = sign(randn(N)) >>> a = arange(N) >>> output = zeros(N) >>> output[input < 0] = 10 * a[input < 0] >>> output[input > 0] = 20 * a[input > 0] >>> Worked fine for me. S.M. -- http://mail.python.org/mailman/list

Re: Pass by reference or by value?

2007-07-13 Thread star . public
On Jul 13, 3:10 pm, Robert Dailey <[EMAIL PROTECTED]> wrote: > Hi, > > I noticed in Python all function parameters seem to be passed by > reference. ... [And later otherwise, etc, snip] Heya. Go read through the thread from yesterday, title starts with "Understanding Python Functions" -- they go t

Re: Can a low-level programmer learn OOP?

2007-07-13 Thread samwyse
On Jul 13, 1:05 pm, Chris Carlen <[EMAIL PROTECTED]> wrote: > John Nagle wrote: > > Chris Carlen wrote:[edit] > >> Hence, being a hardware designer rather than a computer scientist, I > >> am conditioned to think like a machine. I think this is the main > >> reason why OOP has always repelled me.

Re: Can a low-level programmer learn OOP?

2007-07-13 Thread Bruno Desthuilliers
Chris Carlen a écrit : (snip) > > Why? Why is OOP any better at explaining a state machine to a computer? I don't know if it's "better", but state machines are the historical starting point of OO with the Simula language. > I can write state machines all over the place in C, And even in ass

Re: Can a low-level programmer learn OOP?

2007-07-13 Thread Bruno Desthuilliers
Chris Carlen a écrit : > Hi: > > From what I've read of OOP, I don't get it. I have also found some > articles profoundly critical of OOP. I tend to relate to these articles. > > However, those articles were no more objective than the descriptions of > OOP I've read in making a case. Ie., w

Re: Understanding python functions - Instant Python tutorial

2007-07-13 Thread Bruno Desthuilliers
Chris Carlen a écrit : (snip) > > Excellent description. This understandable to me since I can envision > doing this with pointers. But I have no idea how Python actually > implements this. The code source is freely available, and it's in C !-) > It also appears that I am being guided away

Re: help reading cookie values

2007-07-13 Thread kyosohma
On Jul 13, 3:08 pm, Sean <[EMAIL PROTECTED]> wrote: > I am trying to read a cookie I set but I am not sure if I really set > it correctly or I am not reading it correctly. I was given the > following instructions to set the cookie. It appears to be working > because in Firefox browser I see the c

Re: Can a low-level programmer learn OOP?

2007-07-13 Thread Chris Carlen
Neil Cerutti wrote: > Going back to the stack machine question, and using it as an > example: Assume you design your program as a state machine. > Wouldn't it be easier to implement in a (hypothetical) > state-machine-based programming language than in a procedural > one? I think John was insinuati

Re: Can a low-level programmer learn OOP?

2007-07-13 Thread Chris Carlen
Simon Hibbs wrote: > Sorry, here's the tutorial link: > > http://hetland.org/writing/instant-python.html > > > Simon Hibbs Thanks Simon. Actually, that's the tutorial that I've started with. Your comments are encouraging. I'll keep learning. -- Good day!

Re: Pass by reference or by value?

2007-07-13 Thread Carsten Haese
On Fri, 2007-07-13 at 19:22 +, Robert Dailey wrote: > Correction: > > I ran a few more tests and python actually does a pass by value, > meaning that a "copy" is made That is patently incorrect. A function call in Python *never* makes a copy of any of its arguments. > and the external varia

Re: Can a low-level programmer learn OOP?

2007-07-13 Thread Chris Carlen
Bruno Desthuilliers wrote: > Chris Carlen a écrit : >[edit] >> Must possibly learn a completely new way of thinking (OOP) > > Not necessarly. While Python is OO all the way down - meaning that > everything you'll work with will be an object (functions included) -, it > doesn't *force* you into

Re: Pass by reference or by value?

2007-07-13 Thread Bruno Desthuilliers
Robert Dailey a écrit : > On Jul 13, 2:10 pm, Robert Dailey <[EMAIL PROTECTED]> wrote: > >>Hi, >> >>I noticed in Python all function parameters seem to be passed by >>reference. (snip) > > Correction: > > I ran a few more tests and python actually does a pass by value, (snip) Still wrong !-)

Re: Fastest way to convert a byte of integer into a list

2007-07-13 Thread [EMAIL PROTECTED]
On Jul 13, 5:17 am, Paul McGuire <[EMAIL PROTECTED]> wrote: > On Jul 12, 5:34 pm, Godzilla <[EMAIL PROTECTED]> wrote: > > > Hello, > > > I'm trying to find a way to convert an integer (8-bits long for > > starters) and converting them to a list, e.g.: > > > num = 255 > > numList = [1,1,1,1,1,1,1,1]

Re: Numpy array index handling

2007-07-13 Thread phishboh
Thanks a lot for your reply. I'll have a look at the numpy-discussion for future issues. FYI, I'm using Python 2.4.3 for Windows (Enthought Edition) and the included IPython shell. I found my mistake; importing of pylab. E.g., this works from pylab import * ; from scipy import * ; y = arange(3) ;

Re: Can a low-level programmer learn OOP?

2007-07-13 Thread matt westerburg
I also come from a low level background (assembly and c) and I struggled with object oriented programming. People talk about procedural languages or designs and object oriented languages or designs. But after the interpreter or compiler runs the byte or machine code is procedural always. Object

Re: Can a low-level programmer learn OOP?

2007-07-13 Thread Bruno Desthuilliers
Chris Carlen a écrit : > Bruno Desthuilliers wrote: > >> Chris Carlen a écrit : > > >[edit] > >>> Must possibly learn a completely new way of thinking (OOP) >> >> >> Not necessarly. While Python is OO all the way down - meaning that >> everything you'll work with will be an object (functions

Re: Can a low-level programmer learn OOP?

2007-07-13 Thread matt westerburg
On 7/13/07, matt westerburg <[EMAIL PROTECTED]> wrote: I also come from a low level background (assembly and c) and I struggled with object oriented programming. People talk about procedural languages or designs and object oriented languages or designs. But after the interpreter or compiler ru

Re: Getting values out of a CSV

2007-07-13 Thread Kelvie Wong
Hrm. Repeating the test several more times, it seems that the value fluctuates, sometimes one's faster than the other, and sometimes they're the same. Perhaps the minute difference between the two is statistically insignificant? Or perhaps the mechanism underlying both (i.e. the implementation)

Fwd: Can a low-level programmer learn OOP?

2007-07-13 Thread matt westerburg
I also come from a low level background (assembly and c) and I struggled with object oriented programming. People talk about procedural languages or designs and object oriented languages or designs. But after the interpreter or compiler runs the byte or machine code is procedural always. Object

Python Subprocess module

2007-07-13 Thread Dave Sampson
hey folks, A simple question hopefully. despite all my searching I have not found a satisfactory response. The goal. Interact with a command line program. Simple enough, but the key is INTERACT. I tried the shell and comand approaches but that initiates, it does not allow interaction with the

Re: 2**2**2**2**2 wrong? Bug?

2007-07-13 Thread [EMAIL PROTECTED]
On Jul 13, 1:20 pm, Wayne Brehaut <[EMAIL PROTECTED]> wrote: > On Mon, 09 Jul 2007 23:51:25 -0700, "[EMAIL PROTECTED]" > > > > > > <[EMAIL PROTECTED]> wrote: > >On Jul 9, 11:42?pm, Paul McGuire <[EMAIL PROTECTED]> wrote: > >> On Jul 9, 11:21 pm, "Jim Langston" <[EMAIL PROTECTED]> wrote:> In Python

Re: 2**2**2**2**2 wrong? Bug?

2007-07-13 Thread [EMAIL PROTECTED]
On Jul 13, 2:52 pm, Wayne Brehaut <[EMAIL PROTECTED]> wrote: > On Fri, 13 Jul 2007 11:30:16 -0700, Paul McGuire <[EMAIL PROTECTED]> > wrote: > > > > > > >On Jul 13, 1:20 pm, Wayne Brehaut <[EMAIL PROTECTED]> wrote: > >> On Mon, 09 Jul 2007 23:51:25 -0700, "[EMAIL PROTECTED]" > > >> <[EMAIL PROTECTE

Re: Numpy array index handling

2007-07-13 Thread sturlamolden
On 13 Jul, 22:52, [EMAIL PROTECTED] wrote: > It seems a bit risky to use 'from scipy import *'. Maybe it's better > to use 'import scipy' and then scipy.arange, to be sure what is > actually being used? Would there be any disadvanages with that > approach, other than more use of the keyboard? Gen

newbie question on def, passing param's help

2007-07-13 Thread Lance Hoffmeyer
Hey all, I have a def that I have been using but I realized that sometimes I need a LIST with 5 or 6 brands instead of 4 so I want to put LIST outside of the def but I can't wrap my head around a way to get LIST outside the def while still passing the same 4 parameters in the function. I'm sure

Re: Trying to choose between python and java

2007-07-13 Thread James T. Dennis
Hamilton, William <[EMAIL PROTECTED]> wrote: >> From: Beliavsky > On May 15, 1:30 am, Anthony Irwin <[EMAIL PROTECTED]> wrote: >> >>> #5 someone said that they used to use python but stopped because the >>> language changed or made stuff depreciated (I can fully remember >>> which) and old code

Re: Numpy array index handling

2007-07-13 Thread Robert Kern
[EMAIL PROTECTED] wrote: > Thanks a lot for your reply. > I'll have a look at the numpy-discussion for future issues. > > FYI, I'm using Python 2.4.3 for Windows (Enthought Edition) and the > included IPython shell. I found my mistake; importing of pylab. > E.g., this works > from pylab import * ;

Re: Numpy array index handling

2007-07-13 Thread Robert Kern
sturlamolden wrote: > Enthought and similar distros are in my experience "unclean". They > don't always work and they are difficult to update. I rather download > the binary installers (for Windows) and install the packages I need. Right, that's why we (I'm an Enthought employee) haven't been upda

Re: Can a low-level programmer learn OOP?

2007-07-13 Thread Wayne Brehaut
On Sat, 14 Jul 2007 06:01:56 +0200, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: >Chris Carlen a écrit : >> Hi: >> >> From what I've read of OOP, I don't get it. I have also found some >> articles profoundly critical of OOP. I tend to relate to these articles. >> === 8< === >> >> Hence,

Re: Pass by reference or by value?

2007-07-13 Thread Erik Max Francis
James Stroud wrote: > Robert Dailey wrote: >> I noticed in Python all function parameters seem to be passed by >> reference. This means that when I modify the value of a variable of a >> function, the value of the variable externally from the function is >> also modified. >> >> Sometimes I wish to

Re: Right tool and method to strip off html files (python, sed, awk?)

2007-07-13 Thread Jay Loden
[EMAIL PROTECTED] wrote: > I thought about doing that with python (for which I'm in process of > learning), but maybe an other tool (like sed?) would be better suited > for this job. Generally speaking, in my experience, the best tool for the job is the one you know how to use ;) There are of cou

Re: Class decorators do not inherit properly

2007-07-13 Thread Lee Harr
>> I think the term "class decorator" is going to eventually >> mean something other than what you are doing here. I'd >> avoid the term for now. >> >> >> When you decorate a class method, >> the function you use >> needs to be defined before the method definition. > > FWIW, the term "class metho

Re: Can a low-level programmer learn OOP?

2007-07-13 Thread Aahz
In article <[EMAIL PROTECTED]>, Chris Carlen <[EMAIL PROTECTED]> wrote: > >From what I've read of OOP, I don't get it. For that matter, even using OOP a bit with C++ and Perl, I didn't get it until I learned Python. >The problem for me is that I've programmed extensively in C and .asm on >PC

pyMPI installation

2007-07-13 Thread Qilong Ren
Hi, All, I tried to install pyMPI on a linux machine with python2.5 and mpich installed. But always failed. Anyone who has succeeded with the installation? What do I need when doing the configuration? Thanks! Qilong -- http://mail.python.org/mailman/listinfo/python-list

Re: newbie question on def, passing param's help

2007-07-13 Thread Lee Harr
> I have a def that I have been using but I realized that sometimes I need a > LIST with > 5 or 6 brands instead of 4 so I want to put LIST outside of the def but I > can't wrap > my head around a way to get LIST outside the def while still passing the same > 4 > parameters in the function. I'

Re: Pass by reference or by value?

2007-07-13 Thread James Stroud
Erik Max Francis wrote: > James Stroud wrote: > >> Robert Dailey wrote: >> >>> I noticed in Python all function parameters seem to be passed by >>> reference. This means that when I modify the value of a variable of a >>> function, the value of the variable externally from the function is >>> also

Re: interactive graphical script builder

2007-07-13 Thread James Stroud
nik wrote: > Hi, > > I am looking for an interactive graphical script builder for python. > Basically, something like the os X automator. I have made a group of > methods that some non-programmers need to combine into a script. I > don't need a python IDE necessarially, but more of a sequence buil

Re: Pass by reference or by value?

2007-07-13 Thread Dan Bishop
On Jul 13, 2:10 pm, Robert Dailey <[EMAIL PROTECTED]> wrote: > Hi, > > I noticed in Python all function parameters seem to be passed by > reference. This means that when I modify the value of a variable of a > function, the value of the variable externally from the function is > also modified. Pyt

Re: A Python newbie ask a simple question

2007-07-13 Thread Wayne Brehaut
On Fri, 13 Jul 2007 14:51:52 -0400, "Jeff McNeil" <[EMAIL PROTECTED]> wrote: >The raw_input built-in returns a string. The '[0]' subscript returns >the first character in the user supplied response as strings support >indexing. > >[GCC 4.0.1 (Apple Computer, Inc. build 5341)] on darwin >Type "hel

Re: Python Subprocess module

2007-07-13 Thread Dan Stromberg - Datallegro
You could start up a pty and do your own Pexpect-like thing, using read/readline/write. However, this may not be portable to windows. Maybe if you get the python that comes with cygwin, or build your own python under the cygwin environment - that might be more likely to get you pty's under windo

Re: Where does str class represent its data?

2007-07-13 Thread Klaas
On Jul 11, 4:37 pm, Miles <[EMAIL PROTECTED]> wrote: > Since strings are immutable, you need to override the __new__ method. > Seehttp://www.python.org/download/releases/2.2.3/descrintro/#__new__ In case this isn't clear, here is how to do it: In [1]: class MyString(str): ...: def __new__

Re: Python Subprocess module

2007-07-13 Thread [EMAIL PROTECTED]
On Jul 13, 4:15 pm, Dave Sampson <[EMAIL PROTECTED]> wrote: > hey folks, > > A simple question hopefully. despite all my searching I have not found a > satisfactory response. > > The goal. Interact with a command line program. Simple enough, but the > key is INTERACT. > > I tried the shell and coma

Re: os.wait() losing child?

2007-07-13 Thread Jason Zheng
Hrvoje Niksic wrote: > Jason Zheng <[EMAIL PROTECTED]> writes: >> I'm concerned about portability of my code. It will be run on >> multiple machines with mixed Python 2.4 and 2.5 environments. > > I don't think there is a really clean way to handle this. I think the following might just work, alb

Re: Right tool and method to strip off html files (python, sed, awk?)

2007-07-13 Thread [EMAIL PROTECTED]
On Jul 13, 1:57 pm, [EMAIL PROTECTED] wrote: > Hi, > > I'm in the process of refactoring a lot of HTML documents and I'm > using html tidy to do a part of this > work. (clean up, change to xhtml and remove font and center tags) > > Now, Tidy will just do a part of the work I need to > do, I have to

Re: Can a low-level programmer learn OOP?

2007-07-13 Thread Tony23
Chris Carlen wrote: > John Nagle wrote: >> Chris Carlen wrote:[edit] >>> Hence, being a hardware designer rather than a computer scientist, I >>> am conditioned to think like a machine. I think this is the main >>> reason why OOP has always repelled me. >> >> Why? > > When pointers were fir

Re: Right tool and method to strip off html files (python, sed, awk?)

2007-07-13 Thread [EMAIL PROTECTED]
On Jul 13, 7:07 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > On Jul 13, 1:57 pm, [EMAIL PROTECTED] wrote: > > > > > > > Hi, > > > I'm in the process of refactoring a lot of HTML documents and I'm > > using html tidy to do a part of this > > work. (clean up, change to xhtml and remove font a

Re: Can a low-level programmer learn OOP?

2007-07-13 Thread Chris Carlen
Aahz wrote: > In article <[EMAIL PROTECTED]>, > Chris Carlen <[EMAIL PROTECTED]> wrote: >>From what I've read of OOP, I don't get it. > > For that matter, even using OOP a bit with C++ and Perl, I didn't get it > until I learned Python. > >>The problem for me is that I've programmed extensivel

Re: PEP 3107 and stronger typing (note: probably a newbie question)

2007-07-13 Thread Lenard Lindstrom
Hendrik van Rooyen wrote: > "Donn Cave" <[EMAIL PROTECTED]> wrote: > >> In its day, goto was of course very well loved. > > Does anybody know for sure if it is in fact possible to > design a language completely free from conditional jumps? > > At the lower level, I don't think you can get away w

Re: Can a low-level programmer learn OOP?

2007-07-13 Thread Neil Cerutti
On 2007-07-13, Wayne Brehaut <[EMAIL PROTECTED]> wrote: > So Kay actually invented NONE of the concepts that make a PL an > OOPL. He only stated the concepts concisely and named the > result OOP, Naming and categorizing something shouldn't be underestimated as an accomplishment, though. The exerci

Re: Can a low-level programmer learn OOP?

2007-07-13 Thread Steve Holden
Aahz wrote: > In article <[EMAIL PROTECTED]>, > Chris Carlen <[EMAIL PROTECTED]> wrote: >>From what I've read of OOP, I don't get it. > > For that matter, even using OOP a bit with C++ and Perl, I didn't get it > until I learned Python. > >> The problem for me is that I've programmed extensive

Re: A Python newbie ask a simple question

2007-07-13 Thread Steve Holden
Jeff McNeil wrote: > The raw_input built-in returns a string. The '[0]' subscript returns > the first character in the user supplied response as strings support > indexing. > > [GCC 4.0.1 (Apple Computer, Inc. build 5341)] on darwin > Type "help", "copyright", "credits" or "license" for more info

Re: Understanding python functions - Instant Python tutorial

2007-07-13 Thread Wildemar Wildenburger
Wayne Brehaut wrote: >> (had to be a semicolon there) >> > > Not "had to be" since a discerning reader will note that the two > values in the list: > > >>> id(x), id(y) > (19105872, 19091664) Wll, as long as we are nitpicking: That's a tuple, not a list. ;) /W -- http://mail

Re: Understanding python functions - Instant Python tutorial

2007-07-13 Thread Gabriel Genellina
En Fri, 13 Jul 2007 13:41:39 -0300, Chris Carlen <[EMAIL PROTECTED]> escribió: > Ben Finney wrote: >> Some languages have "variables", which act like boxes that have names >> etched on the side. Once created, the box can contain an object, and >> it can be inspected while in the box; to change t

Re: Function parameter type safety?

2007-07-13 Thread George Sakkis
On Jul 12, 5:52 pm, Robert Dailey <[EMAIL PROTECTED]> wrote: > Hi, > > Is there a way to force a specific parameter in a function to be a > specific type? Yes; have a look at typecheck (http://oakwinter.com/code/typecheck/) and FormEncode (http://formencode.org/Validator.html). George -- http:

Re: MaildirMessage

2007-07-13 Thread Gabriel Genellina
En Fri, 13 Jul 2007 07:38:01 -0300, Tzury <[EMAIL PROTECTED]> escribió: >> Which is a bug in the 'email.message' module, in my view. If it's >> attempting to support a mapping protocol, it should allow iteration >> the same way standard Python mappings do: by iterating over the keys. > > I thoug

Re: Can a low-level programmer learn OOP?

2007-07-13 Thread BJörn Lindqvist
On 7/13/07, John Nagle <[EMAIL PROTECTED]> wrote: > You can sometimes get better performance in C++ than in C, because C++ > has "inline". Inline expansion happens before optimization, so you > can have abstractions that cost nothing. C99 has that too. > Python is a relatively easy lan

Re: permission denied in shutil.copyfile

2007-07-13 Thread Gabriel Genellina
En Fri, 13 Jul 2007 12:10:20 -0300, Ahmed, Shakir <[EMAIL PROTECTED]> escribió: > Is there any way to copy a file from src to dst if the dst is > exclusively open by other users. > > I am using > > src = 'c:\mydata\data\*.mdb' > dst = 'v:\data\all\*.mdb' > > shutil.copyfile(src,dst) > > but get

Re: MaildirMessage

2007-07-13 Thread Ben Finney
Steve Holden <[EMAIL PROTECTED]> writes: > Ben Finney wrote: > > Which is a bug in the 'email.message' module, in my view. If it's > > attempting to support a mapping protocol, it should allow > > iteration the same way standard Python mappings do: by iterating > > over the keys. > > Stop assuming

Re: permission denied in shutil.copyfile

2007-07-13 Thread Steve Holden
Gabriel Genellina wrote: > En Fri, 13 Jul 2007 12:10:20 -0300, Ahmed, Shakir <[EMAIL PROTECTED]> > escribió: > >> Is there any way to copy a file from src to dst if the dst is >> exclusively open by other users. >> >> I am using >> >> src = 'c:\mydata\data\*.mdb' >> dst = 'v:\data\all\*.mdb' >>

Re: Understanding python functions - Instant Python tutorial

2007-07-13 Thread Ben Finney
Chris Carlen <[EMAIL PROTECTED]> writes: > Excellent description. This understandable to me since I can > envision doing this with pointers. It would be better if you thought in terms of "refrences". Python names are unlike pointers in that they don't "store" anything. The *only* thing to do wit

Re: MaildirMessage

2007-07-13 Thread Steve Holden
Ben Finney wrote: > Steve Holden <[EMAIL PROTECTED]> writes: > >> Ben Finney wrote: >>> Which is a bug in the 'email.message' module, in my view. If it's >>> attempting to support a mapping protocol, it should allow >>> iteration the same way standard Python mappings do: by iterating >>> over the

Re: Circular import problem

2007-07-13 Thread bvdp
Just as a bit of a followup, I have fixed the problem in my code. I changed the order of some of the imports in some other modules. What I was doing was more guesswork and good luck ... but it works. I really wonder if there is a better way to figure these problems out. Reading a few of the other

Can I change one line in a file without rewriting the whole thing?

2007-07-13 Thread J. J. Ramsey
In Perl, there is a module called "Tie::File". What it does is tie a list to each line of a file. Change the list, and the file is automatically changed, and on top of this, only the bits of the file that need to be changed are written to disk. At least, that's the general idea. I was wondering if

ANN: PyBridge: Drupal modules in Python

2007-07-13 Thread DavidM
Hi all, I wonder if I'm the only one who likes the Drupal (www.drupal.org) web CMS framework, but much prefers Python as a programming language. Anyway, I've put up the first cut of PyBridge - a framework that allows Drupal extension modules to be written in Python. http://www.freenet.org.nz/pyb

Re: Getting values out of a CSV

2007-07-13 Thread Gabriel Genellina
En Fri, 13 Jul 2007 09:05:29 -0300, Daniel <[EMAIL PROTECTED]> escribió: >>> > Note that every time you see [x for x in ...] with no condition, you >>> can >>> > write list(...) instead - more clear, and faster. >>> > >>> > data = list(csv.reader(open('some.csv', 'rb'))) >>> >>> Faster? No. List C

Re: how to install pygame package?

2007-07-13 Thread zaperaj
There seems to be some problem. For the tar version, initial steps execute OK, but after typing: [EMAIL PROTECTED] pygame-1.7.1release]# ./configure bash: ./configure: No such file or directory So i don't hav a configure file? What should i do now? -- http://mail.python.org/mailman/listinfo/pyth

Re: interactive graphical script builder

2007-07-13 Thread Robert Kern
James Stroud wrote: > nik wrote: >> Hi, >> >> I am looking for an interactive graphical script builder for python. >> Basically, something like the os X automator. I have made a group of >> methods that some non-programmers need to combine into a script. I >> don't need a python IDE necessarially,

Re: Function parameter type safety?

2007-07-13 Thread Gabriel Genellina
En Fri, 13 Jul 2007 11:53:41 -0300, Robert Dailey <[EMAIL PROTECTED]> escribió: > However, I found it isn't possible since Python > mainly works with strings in file data instead of bytes. To write a > number 40 to a file in python would take 6 bytes instead of 4, for > example. py> import

Re: Circular import problem

2007-07-13 Thread Gabriel Genellina
En Fri, 13 Jul 2007 13:24:57 -0300, bvdp <[EMAIL PROTECTED]> escribió: > >> Seehttp://effbot.org/zone/import-confusion.htm >> Try to move the circular references later in the code (maybe inside a >> function, when it is required), or much better, refactor it so there is >> no >> circularity. >>

Re: Pass by reference or by value?

2007-07-13 Thread sturlamolden
On Jul 13, 9:10 pm, Robert Dailey <[EMAIL PROTECTED]> wrote: > I noticed in Python all function parameters seem to be passed by > reference. This means that when I modify the value of a variable of a > function, the value of the variable externally from the function is > also modified. Pass-by-v

Re: Can I change one line in a file without rewriting the whole thing?

2007-07-13 Thread David Wahler
On 7/13/07, J. J. Ramsey <[EMAIL PROTECTED]> wrote: > In Perl, there is a module called "Tie::File". What it does is tie a > list to each line of a file. Change the list, and the file is > automatically changed, and on top of this, only the bits of the file > that need to be changed are written to

Re: Can I change one line in a file without rewriting the whole thing?

2007-07-13 Thread Gabriel Genellina
En Fri, 13 Jul 2007 23:46:24 -0300, J. J. Ramsey <[EMAIL PROTECTED]> escribió: > In Perl, there is a module called "Tie::File". What it does is tie a > list to each line of a file. Change the list, and the file is > automatically changed, and on top of this, only the bits of the file > that need

Re: Can a low-level programmer learn OOP?

2007-07-13 Thread Alex Martelli
Chris Carlen <[EMAIL PROTECTED]> wrote: > From what I've read of OOP, I don't get it. I have also found some > articles profoundly critical of OOP. I tend to relate to these articles. OOP can be abused (particularly with deep or intricate inheritance structures). But the base concept is simpl

installation problems on mac powerpc

2007-07-13 Thread python27email
interested in nltk installation on a mac osx 10.4.9 however when try to install latest python get error cannot access subprocesses and won't even open idle got nltk to open through a terminal but entire process I fear is fragmented is there a better walk through of installation than what I've f

Re: Understanding python functions - Instant Python tutorial

2007-07-13 Thread Wayne Brehaut
On Sat, 14 Jul 2007 03:18:43 +0200, Wildemar Wildenburger <[EMAIL PROTECTED]> wrote: >Wayne Brehaut wrote: >>> (had to be a semicolon there) >>> >> >> Not "had to be" since a discerning reader will note that the two >> values in the list: >> >> >>> id(x), id(y) >> (19105872, 1909166

TurboGears on Summer Madness

2007-07-13 Thread SamFeltus
Here is a new style of SonomaSunshine page, edited and created with TurboGears. It's a bloated file, but it's comical. Note - Links with words stay on page,links without words are random links to other sites. Visiting Monkey City first is recommended. As always, LIVE FROM LA!!! http://samfeltus

Re: Fast powerset function

2007-07-13 Thread Mark Dickinson
If you don't care about the order of the results, you can use a Gray code (http://en.wikipedia.org/wiki/Gray_code): this has the advantage of only adding or removing a single element to get from one subset to the next. def powerset(s): d = dict(zip( (1<>> list(powerset('abc')) [set

Re: installation problems on mac powerpc

2007-07-13 Thread python27email
On Jul 14, 1:21 am, [EMAIL PROTECTED] wrote: > interested in nltk installation on a mac osx 10.4.9 > > however when try to install latest python > > get error cannot access subprocesses and won't even open idle > got nltk to open through a terminal but entire process I fear is > fragmented > > is t

<    1   2