Re: Open a List of Files

2008-01-08 Thread Fredrik Lundh
Terry Jones wrote: > I think you should revisit this decision. Something like Fredrik's code is > the way to go. He used my suggestion, just for a few more files than he had in his original post. Seriously, for a limited number of files, the dictionary approach is mostly pointless; you end up

Tracking colors

2008-01-08 Thread dongie . agnir
I'm just getting started with Python, and I want to do a bit of color tracking using VideoCapture. However, I've never worked with video or images, so I'm a little at a loss. How would I use VideoCapture to track a specified color, and its coordinates? -- http://mail.python.org/mailman/listinfo/

Re: hkimball's question on ctypes

2008-01-08 Thread oyster
2008/1/9, [EMAIL PROTECTED] <[EMAIL PROTECTED]>: > Date: Tue, 8 Jan 2008 17:11:18 -0800 (PST) > Subject: ctypes 1. please make your title more specific > >>> from ctypes import * > >>> cdecl = > cdll.LoadLibrary("c:\projects\python\geinterface.dll") 2. are you sure '\' is ok? cdll.LoadLibrary(r"c:

Re: Collecting Rich Data Structures for students

2008-01-08 Thread Paddy
On Jan 9, 2:19 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Greetings Pythoneers -- > > Some of us over on edu-sig, one of the community actives, > have been brainstorming around this Rich Data Structures > idea, by which we mean Python data structures already > populated with non-trivial d

Re: Pet Store

2008-01-08 Thread Jeroen Ruigrok van der Werven
-On [20080108 19:36], George Maggessy ([EMAIL PROTECTED]) wrote: >Yeap. It is. I'm looking for something like that app. Smth that I >could base my future developments on. If you want to go the Ruby on Rails-like road then you have Django, Pylons, TurboGears, Zope, to name four of the

Congratulations to the CPython Developers on an outstanding codebase

2008-01-08 Thread Paddy
It looks a bit like an add for Coverity, but under all that, they seem to have picked Python as one of the OS projects to test with their improved testing software because our developers were so good at working on any "bugs" reported by their earlier tool. Good job guys. http://scan.coverity.com

Re: Pet Store

2008-01-08 Thread Nikola Stjelja
On Jan 8, 2008 7:32 PM, George Maggessy <[EMAIL PROTECTED]> wrote: > Yeap. It is. I'm looking for something like that app. Smth that I > could base my future developments on. > > On Jan 8, 1:47 am, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > > On Mon, 07 Jan 2008 22:21:53 -0800, George M

Re: module pickle

2008-01-08 Thread Nikola Stjelja
On Jan 9, 2008 5:29 AM, Beema shafreen <[EMAIL PROTECTED]> wrote: > Hi I am beginner in python. and I am not able to understand the Pickle > concept in python can. some body explain me about the use of this module, > few examples. which will help me a lot. > > regards > shafreen > > -- > http://m

Re: Default location of python on OS X

2008-01-08 Thread Stephen_B
On Jan 8, 11:33 pm, Tommy Nordgren <[EMAIL PROTECTED]> wrote: > > I still have a "/Library/Python/2.3" and a "/Library/Python/2.5". > > > Thanks. > > > Stephen > Leopard INCLUDES Python 2.5, there is no need to install it. Thanks -- that made the decision easy. I didn't need all those MacP

Re: Open a List of Files

2008-01-08 Thread BJ Swope
On Jan 8, 2008 9:34 PM, Terry Jones <[EMAIL PROTECTED]> wrote: > > I think you should revisit this decision. Something like Fredrik's code > is > the way to go. It has multiple advantages: > > - It's much shorter. > - It's arguably easier to add/remove to/from. > - It has less risk of error (

Re: copy a numpy array

2008-01-08 Thread jimgardener
thanx guys for the replies need a little clarification srcarray=array([1.2,2.3,3.4,4.5,5.6]) destarray=array(srcarray,copy=False) then srcarray[2]=99.9 will cause the change to be reflected in both src and dest. doesn't that mean data is shared between both arrays? but if i do destarray=array(sr

Re: Default location of python on OS X

2008-01-08 Thread Tommy Nordgren
On 9 jan 2008, at 04.43, Stephen_B wrote: > I've installed the latest 2.5 python today from python.org, and I > think it ended up in "/Applications/MacPython 2.5". > > I also have a "/Applications/MacPython 2.4" and a "/Applications/ > MacPython-2.4". Can I delete these, or did one of them come w

Re: pipes python cgi and gnupg

2008-01-08 Thread alisonken1
On Dec 28 2007, 7:07 pm, [EMAIL PROTECTED] wrote: > form = cgi.FieldStorage() > if not form.has_key("pass"): >print "Enter password" > > filename = "test.gpg" > pass = form.getvalue("pass").strip() > os.system("gpg --version > gpg.out") > os.system("echo %s | gpg --batch --password-fd 0 --decr

Re: [Tutor] Pyflakes pre-commit hook in subversion

2008-01-08 Thread mobiledreamers
yes the link is broken and hence i sent it in since it is a conf file for svn pre-commit hook so pyflakes is run of your tree and it emits an error if python files have any error preventing bad commits poisoning svn tree so dev can fix the bug and recommit On Jan 8, 2008 8:08 PM, Kent Johnson <[EM

module pickle

2008-01-08 Thread Beema shafreen
Hi I am beginner in python. and I am not able to understand the Pickle concept in python can. some body explain me about the use of this module, few examples. which will help me a lot. regards shafreen -- http://mail.python.org/mailman/listinfo/python-list

Default location of python on OS X

2008-01-08 Thread Stephen_B
I've installed the latest 2.5 python today from python.org, and I think it ended up in "/Applications/MacPython 2.5". I also have a "/Applications/MacPython 2.4" and a "/Applications/ MacPython-2.4". Can I delete these, or did one of them come with Leopard? I still have a "/Library/Python/2.3" an

Pyflakes pre-commit hook in subversion

2008-01-08 Thread Mark
http://tarekziade.wordpress.com/2006/11/01/protecting-a-python-svn-code-base-with-the-pre-commit-hook/ Is it possible to check code in python before committing to svn   using pyflakes, pythontidy Pyflakes and Subversion Pyflakes is a nice little utility that checks your Python code for err

Re: Spaces and tabs messing up code

2008-01-08 Thread Ben Finney
Robert Hicks <[EMAIL PROTECTED]> writes: > [EMAIL PROTECTED] wrote: > > my friend uses vim > > and i use xemacs > > so our shared python code is a mix of tabs and spaces and it is hard > > for him to edit it in vim > > any idea on how to make it clean > > convert it all to 4 spaces? > > Thanks >

Re: Python's great, in a word

2008-01-08 Thread Basilisk96
On Jan 7, 8:09 am, [EMAIL PROTECTED] wrote: > I'm a Java guy who's been doing Python for a month now and I'm > convinced that > > 1) a multi-paradigm language is inherently better than a mono-paradigm > language > > 2) Python writes like a talented figure skater skates. > > Would you Python old-tim

Re: Spaces and tabs messing up code

2008-01-08 Thread Robert Hicks
[EMAIL PROTECTED] wrote: > my friend uses vim > and i use xemacs > so our shared python code is a mix of tabs and spaces and it is hard for > him to edit it in vim > > any idea on how to make it clean > convert it all to 4 spaces? > > Thanks > :set ts=4 :retab! :h retab -- http://mail.pyt

Re: Open a List of Files

2008-01-08 Thread Tim Chase
> I decided that I was just trying to be "too smooth by 1/2" so I fell back to > > messages = open(os.path.join(host_path,'messages.txt'), 'wb') > deliveries = open(os.path.join(host_path,'deliveries.txt'), 'wb') > actions = open(os.path.join(host_path,'actions.txt'), 'wb') > parts = open(os.path.

Re: Open a List of Files

2008-01-08 Thread Terry Jones
Hi BJ > > Fredrik Lundh <[EMAIL PROTECTED]> writes: > > Or in a dict: > > > > open_files = {} > > for fn in ['messages', 'recipients', 'viruses']: > >open_files[fn] = open(getfilename(fn), 'w') > > I decided that I was just trying to be "too smooth by 1/2" so I fell back > to ... > > message

Collecting Rich Data Structures for students

2008-01-08 Thread [EMAIL PROTECTED]
Greetings Pythoneers -- Some of us over on edu-sig, one of the community actives, have been brainstorming around this Rich Data Structures idea, by which we mean Python data structures already populated with non-trivial data about various topics such as: periodic table (proton, neutron counts);

Re: [Tutor] Spaces and tabs messing up code

2008-01-08 Thread Reed O'Brien
On Jan 8, 2008, at 7:49 PM, Bill Campbell wrote: > On Tue, Jan 08, 2008, [EMAIL PROTECTED] wrote: >> >> my friend uses vim Small editors for small minds;) >> >> and i use xemacs >> >> so our shared python code is a mix of tabs and spaces and it is >> hard >> for him to edit it in vim >

Re: Open a List of Files

2008-01-08 Thread BJ Swope
On Jan 8, 2008 7:22 AM, Hrvoje Niksic <[EMAIL PROTECTED]> wrote: > Fredrik Lundh <[EMAIL PROTECTED]> writes: > > > BJ Swope wrote: > > > >> the code looks ok. please define "not working". > >> > >> Yep, defining "not working" is always helpful! :) > >> > >> I want to have all 3 files open at

Natural-language datetime parsing and display (was: user friendly datetime features)

2008-01-08 Thread Ben Finney
"Daniel Fetchinson" <[EMAIL PROTECTED]> writes: > I'm guessing this feature is needed so often in so many projects that > it has been implemented already by several people. Does anyone know of > such a stand alone module? The 'python-dateutil' library allows easy *programmatic* manipulation of re

site promotion

2008-01-08 Thread justin . evans2
hello, i would like to advertise a few sites their all pretty healthy t make improvements to your life! one of them is www.bigleagueplayersclub.com/3clicks/published/67153/196170 thanks check it ut thers more verious things to see -- http://mail.python.org/mailman/listinfo/python-list

Re: [Tutor] Spaces and tabs messing up code

2008-01-08 Thread Bill Burns
[EMAIL PROTECTED] wrote: > my friend uses vim > and i use xemacs > so our shared python code is a mix of tabs and spaces and it is hard for > him to edit it in vim > > any idea on how to make it clean > convert it all to 4 spaces? > > Thanks > Take a look at reindent.py. This script lives in

user friendly datetime features

2008-01-08 Thread Daniel Fetchinson
Many times a more user friendly date format is convenient than the pure date and time. For example for a date that is yesterday I would like to see "yesterday" instead of the date itself. And for a date that was 2 days ago I would like to see "2 days ago" but for something that was 4 days ago I wou

Re: 'Borg' and multiple threads.

2008-01-08 Thread Mike Mazur
Hi, On Jan 8, 2008 7:24 AM, Tobiah <[EMAIL PROTECTED]> wrote: > I have a class that I call Borg that starts like this: > > class Borg(dict): > > static_state = {} > def __init__(self): > self.__dict__ = self.static_state > > > so that I can access the same data from

ctypes

2008-01-08 Thread hkimball
I am trying to call a function in a third party dll that spawns an exe and I am using ctypes. Python does not complain at all but the other process does not get spawned. It appears that I am gaining access to the functions but with no results. Any ideas? Thanks in advance. >>> from ctypes impo

Re: [Tutor] Spaces and tabs messing up code

2008-01-08 Thread Bill Campbell
On Tue, Jan 08, 2008, [EMAIL PROTECTED] wrote: > > my friend uses vim > > and i use xemacs > > so our shared python code is a mix of tabs and spaces and it is hard > for him to edit it in vim > > any idea on how to make it clean > > convert it all to 4 spaces? Do that, and in his ~/.vi

Re: popen question

2008-01-08 Thread Karthik Gurusamy
On Jan 8, 1:20 am, Robert Latest <[EMAIL PROTECTED]> wrote: > Hello, > > look at this function: > > -- > def test(): > child = os.popen('./slow') > for line in child: > print line > - > > The program "slow" just writes the numbers 0 through 9 on stdout, one l

Help wanted with GTK+ program

2008-01-08 Thread Hollaburoo
I'm working on a simple GTK+ wrapper around the flash Pandora Radio player (Pandora.com). It's very basic right now but I've got it almost working. I'm using gtkmozembed to fetch and use the player and dbus to detect multimedia keys. The only problem I'm having is that the mozembed widget doesn't

Spaces and tabs messing up code

2008-01-08 Thread mobiledreamers
my friend uses vim and i use xemacs so our shared python code is a mix of tabs and spaces and it is hard for him to edit it in vim any idea on how to make it clean convert it all to 4 spaces? Thanks -- http://mail.python.org/mailman/listinfo/python-list

'Borg' and multiple threads.

2008-01-08 Thread Tobiah
I have a class that I call Borg that starts like this: class Borg(dict): static_state = {} def __init__(self): self.__dict__ = self.static_state so that I can access the same data from anywhere within any module or function just by instantiating one. This is use

Re: Open source English dictionary to use programmatically w/ python

2008-01-08 Thread Tobiah
dgoldsmith_89 wrote: > Can anyone point me to a downloadable open source English dictionary > suitable for programmatic use with python: I'm programming a puzzle > generator, and I need to be able to generate more or less complete > lists of English words, alphabetized. Thanks! DG If all you wan

Spring Python 0.3.2 is release!

2008-01-08 Thread Goldfish
Spring Python (http://springpython.python-hosting.com) version 0.3.2 was released yesterday. It contains a patch to an error discovered 12/19/2007 in XmlApplicationContext, that broke when PROTOTYPE scoping was used. Test cases have been updated to detect this bug, and in turn the correction was m

Re: Python setup not working on Windows XP

2008-01-08 Thread Graham Dumpleton
On Jan 8, 5:31 pm, Tim Roberts <[EMAIL PROTECTED]> wrote: > Gowri <[EMAIL PROTECTED]> wrote: > > >I am new to Python and am trying to setup Apache to serve Python using > >mod_python. I'm using a Windows XP box. here is a list of steps i > >followed for the installation: > > >1. Installed Apache 2.

Re: stupid/style/list question

2008-01-08 Thread Raymond Hettinger
On Jan 8, 7:34 am, "Giampaolo Rodola'" <[EMAIL PROTECTED]> wrote: > I was wondering... > To flush a list it is better doing "del mylist[:]" or "mylist = []"? > Is there a preferred way? If yes, why? To empty an existing list without replacing it, the choices are "del mylist[:]" and "mylist[:] = [

ANN: matplotlib-0.91.2 - a python graphics package

2008-01-08 Thread [EMAIL PROTECTED]
A new release of matplotlib is posted to the sourceforge download site. You can read the release notes with links at http://matplotlib.sourceforge.net/whats_new.html Download: Downloads: http://sourceforge.net/project/showfiles.php?group_id=80706 Homepage: http://matplotlib.sourceforge.net

Re: Newbie question: Classes

2008-01-08 Thread kyosohma
On Jan 8, 3:31 pm, "Daniel Fetchinson" <[EMAIL PROTECTED]> wrote: > > Basically, I have created a program using tkinter without using any class > > structure, simply creating widgets and functions (and finding ways around > > passing variables from function to function, using global variables etc).

Re: Python or PowerShell ?

2008-01-08 Thread Matimus
On Jan 8, 2:24 pm, Torsten Bronger <[EMAIL PROTECTED]> wrote: > Hallöchen! > > [EMAIL PROTECTED] writes: > > I am all about using the right tool for the right purposes, [...] > > Which purpose? > > > I dug up one article from Google that talked about comparison but > > that was about it. > > >http:

Re: Modules and descriptors

2008-01-08 Thread Steven Bethard
Chris Leary wrote: > As I understand it, the appeal of properties (and descriptors in > general) in new-style classes is that they provide a way to > "intercept" direct attribute accesses. This lets us write more clear > and concise code that accesses members directly without fear of future > API c

Re: mod-python on Mac OSX 10.5

2008-01-08 Thread Arnaud Delobelle
On Jan 8, 5:27 am, Gnarlodious <[EMAIL PROTECTED]> wrote: > I am trying to install mod_python on OSX 10.5, Intel version. > > sudo apachectl configtest tells me this: > > httpd: Syntax error on line 114 of /private/etc/apache2/httpd.conf: > Cannot load /usr/libexec/apache2/mod_python.so into server

mod-python on Mac OSX 10.5

2008-01-08 Thread Gnarlodious
I am trying to install mod_python on OSX 10.5, Intel version. sudo apachectl configtest tells me this: httpd: Syntax error on line 114 of /private/etc/apache2/httpd.conf: Cannot load /usr/libexec/apache2/mod_python.so into server: dlopen(/usr/libexec/apache2/mod_python.so, 10): no suitable imag

Re: Newbie question: Classes

2008-01-08 Thread Daniel Fetchinson
> Basically, I have created a program using tkinter without using any class > structure, simply creating widgets and functions (and finding ways around > passing variables from function to function, using global variables etc). > The program has become rather large ( lines?) I am trying to now put

Re: I'm searching for Python style guidelines

2008-01-08 Thread Matthew Woodcraft
<[EMAIL PROTECTED]> wrote: > A quick look (thorough analysis still required) shows that OLPC and > PyPy are, indeed, extensive standards. > one-laptop-per-child.html > (olpc),74.3,,http://wiki.laptop.org/go/Python_Style_Guide I think that's mostly PEP 8, with some notes added. -M- -- http://m

Re: I'm searching for Python style guidelines

2008-01-08 Thread Matthew Woodcraft
Paul McGuire <[EMAIL PROTECTED]> wrote: > While not required by any means, you will also find it handy to follow > *every* entry in the list with a comma, even the last one in the list > (this is legal Python). That is, in your example: > > foo =3D [ > 'too long', > 'too long too', >

Re: Look for a string on a file and get its line number

2008-01-08 Thread jcvanelst
On 8 jan, 03:19, Horacius ReX <[EMAIL PROTECTED]> wrote: > Hi, > > I have to search for a string on a big file. Once this string is > found, I would need to get the number of the line in which the string > is located on the file. Do you know how if this is possible to do in > python ? > > Thanks h

Javascript parser

2008-01-08 Thread Christof Hoeke
hello, is there any Javascript (not just JSON) parser for Python? I saw http://wwwsearch.sourceforge.net/python-spidermonkey/ which seems to be from 2003 and unmaintained and seems to be quite complicated to get to work anyway :( Using Rhino from Jython is not really an option as I'd like to wo

Re: Python or PowerShell ?

2008-01-08 Thread kyosohma
On Jan 8, 1:57 pm, "Martin P. Hellwig" <[EMAIL PROTECTED]> wrote: > Torsten Bronger wrote: > > Hallöchen! > > > [EMAIL PROTECTED] writes: > > >> I am all about using the right tool for the right purposes, [...] > > > Which purpose? > > >> I dug up one article from Google that talked about compariso

ZSI and .NET

2008-01-08 Thread Joseph Bernhardt
I am successfully using ZSI to create a web service for our internal use. A request containing a username and password will respond with user information. Sample Request: Jough joughspassword Response for Sample Request: http://www.w3.org/2001/XMLSch

Re: Python's great, in a word

2008-01-08 Thread James Matthews
We have such nice names so the word Python will be something people like and not something people fear (A massive 12 foot snake) and Pythonic is a behavior pattern we should all follow! In layman's terms it means we should all act like snakes a little more! On Jan 8, 2008 5:13 PM, Carl Banks <[EMA

Re: Python or PowerShell ?

2008-01-08 Thread Martin P. Hellwig
Torsten Bronger wrote: > Hallöchen! > > [EMAIL PROTECTED] writes: > >> I am all about using the right tool for the right purposes, [...] > > Which purpose? > >> I dug up one article from Google that talked about comparison but >> that was about it. >> >> http://www.simple-talk.com/sql/database-

Re: Peer To Peer File Sharing...

2008-01-08 Thread James Matthews
Look at the old source code of the Bittorrent client for ideas! On Jan 8, 2008 8:51 PM, Dom Rout <[EMAIL PROTECTED]> wrote: > Hello. > Well, this is my first post on any USENET group anywhere, so I hope I > get it right. Basically, I just want to get some opinions on a plan of > mine for a new pr

Peer To Peer File Sharing...

2008-01-08 Thread Dom Rout
Hello. Well, this is my first post on any USENET group anywhere, so I hope I get it right. Basically, I just want to get some opinions on a plan of mine for a new project. I want to produce a small, peer to peer, file sharing network for the use of myself and some of my friends. The purpose of thi

Newbie question: Classes

2008-01-08 Thread Sam Garson
Hello all Basically, I have created a program using tkinter without using any class structure, simply creating widgets and functions (and finding ways around passing variables from function to function, using global variables etc). The program has become rather large ( lines?) I am trying to now p

Re: Python or PowerShell ?

2008-01-08 Thread Torsten Bronger
Hallöchen! [EMAIL PROTECTED] writes: > I am all about using the right tool for the right purposes, [...] Which purpose? > I dug up one article from Google that talked about comparison but > that was about it. > > http://www.simple-talk.com/sql/database-administration/comparing-python-and-powers

Re: COM server and EXE

2008-01-08 Thread Giles Brown
On 8 Jan, 11:04, Teja <[EMAIL PROTECTED]> wrote: > On Jan 8, 3:33 pm, Teja <[EMAIL PROTECTED]> wrote: > > > > > Hi All, > > > I have a Python COM server. I need to deploy it on various sytems. > > When I run the COM server from > > python its showing an output " Registered : sample.lib" > > > If I

Re: stupid/style/list question

2008-01-08 Thread Giampaolo Rodola'
On 8 Gen, 16:45, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Giampaolo Rodola' wrote: > > To flush a list it is better doing "del mylist[:]" or "mylist = []"? > > Is there a preferred way? If yes, why? > > The latter creates a new list object, the former modifies an existing > list in place. > > The

Python or PowerShell ?

2008-01-08 Thread [EMAIL PROTECTED]
I am all about using the right tool for the right purposes, which is why I have started reading the GettingStarted guide to PowerShell. I am curious if any other pythoneers have ventured into the world of PowerShell. Mostly, I am interested in grabbing perspectives on the differences noticed fro

Re: Pet Store

2008-01-08 Thread George Maggessy
Yeap. It is. I'm looking for something like that app. Smth that I could base my future developments on. On Jan 8, 1:47 am, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > On Mon, 07 Jan 2008 22:21:53 -0800, George Maggessy wrote: > > I'm an experience Java developer trying to learn Python. I

Re: Open source English dictionary to use programmatically w/ python

2008-01-08 Thread dgoldsmith_89
On Jan 7, 3:50 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > On Jan 7, 5:10 pm, dgoldsmith_89 <[EMAIL PROTECTED]> wrote: > > > > > On Jan 7, 2:54 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > > > > On Jan 7, 4:37 pm, dgoldsmith_89 <[EMAIL PROTECTED]> wrote: > > > > > Can anyone point

Re: copy a numpy array

2008-01-08 Thread gsal
I am new to python and everything related to it, and it so happens that I just went through the numpy tutorial last night, it is in http://www.scipy.org/Tentative_NumPy_Tutorial and the answer to your question is in section 3.7 Basically, if you want to make a (deep) copy of it: destarray = src

Re: I'm searching for Python style guidelines

2008-01-08 Thread Neil Cerutti
On Jan 8, 2008 12:35 PM, Martin Vilcans <[EMAIL PROTECTED]> wrote: > On 1/7/08, Guilherme Polo <[EMAIL PROTECTED]> wrote: > > 2008/1/7, [EMAIL PROTECTED] <[EMAIL PROTECTED]>: > > > Anything written somewhere that's thorough? Any code body that should > > > serve as a reference? > > > > PEP 8 > > ht

Re: I'm searching for Python style guidelines

2008-01-08 Thread Colin J. Williams
Martin Vilcans wrote: > On 1/7/08, Guilherme Polo <[EMAIL PROTECTED]> wrote: >> 2008/1/7, [EMAIL PROTECTED] <[EMAIL PROTECTED]>: >>> Anything written somewhere that's thorough? Any code body that should >>> serve as a reference? >> PEP 8 >> http://www.python.org/dev/peps/pep-0008/ > > The problem

Re: I'm searching for Python style guidelines

2008-01-08 Thread Martin Vilcans
On 1/7/08, Guilherme Polo <[EMAIL PROTECTED]> wrote: > 2008/1/7, [EMAIL PROTECTED] <[EMAIL PROTECTED]>: > > Anything written somewhere that's thorough? Any code body that should > > serve as a reference? > > PEP 8 > http://www.python.org/dev/peps/pep-0008/ The problem with PEP 8 is that even code

Re: copy a numpy array

2008-01-08 Thread Francesco Guerrieri
On Jan 8, 2008 4:32 PM, jimgardener <[EMAIL PROTECTED]> wrote: > hi, > (i posted this to numpy discussion grp couple of days back ..but it > fails to appear..)since it is needed for my work i would appreciate if > anyone can help me with this question > > > i have two ndarrays of 1000 elements each

Re: I'm searching for Python style guidelines

2008-01-08 Thread MartinRinehart
That's a great list, grflanagan! Thanks. I looked at each and copied to my disk either as a .txt (cut/paste from the browser) for a page or less or as .html (view source, chop off head and non-guideline stuff, save). This is the list plus PEP 8 minus the software. (No disrespect for the software,

Re: Python's great, in a word

2008-01-08 Thread Carl Banks
On Jan 7, 6:29 pm, MRAB <[EMAIL PROTECTED]> wrote: > On Jan 7, 5:40 pm, Martin Marcher <[EMAIL PROTECTED]> wrote:> [EMAIL > PROTECTED] wrote: > > > The best thing about Python is ___. > > > it's pythonicness. > > I think it sounds better as "its pythonicity". Mixing Greek and Latin suffixes u

Re: stupid/style/list question

2008-01-08 Thread Tim Chase
> To flush a list it is better doing "del mylist[:]" or "mylist = []"? > Is there a preferred way? If yes, why? It depends on what you want. The former modifies the list in-place while the latter just reassigns the name "mylist" to point to a new list within the local scope as demonstrated by thi

Re: list property fires get on append

2008-01-08 Thread Soviut
On Jan 6, 11:36 am, Carl Banks <[EMAIL PROTECTED]> wrote: > On Sun, 06 Jan 2008 00:31:13 -0800, Soviut wrote: > > I figured that an append would be treated as a set since I'm adding to > > the list. But what you say makes sense, although I can't say I'm happy > > with the behaviour. Is there any

Re: stupid/style/list question

2008-01-08 Thread Fredrik Lundh
Giampaolo Rodola' wrote: > To flush a list it is better doing "del mylist[:]" or "mylist = []"? > Is there a preferred way? If yes, why? The latter creates a new list object, the former modifies an existing list in place. The latter is shorter, reads better, and is probably a bit faster in mos

stupid/style/list question

2008-01-08 Thread Giampaolo Rodola'
I was wondering... To flush a list it is better doing "del mylist[:]" or "mylist = []"? Is there a preferred way? If yes, why? -- http://mail.python.org/mailman/listinfo/python-list

Re: Intranet Project - Rad Or Waterfall

2008-01-08 Thread GHUM
> Option 1 - Waterfall I recommend to google "waterfall". First hit after those beatifull pictures will be: http://en.wikipedia.org/wiki/Waterfall_model Within the first paragraph there is: """Ironically, Royce was actually presenting this model as an example of a flawed, non-working model.(

copy a numpy array

2008-01-08 Thread jimgardener
hi, (i posted this to numpy discussion grp couple of days back ..but it fails to appear..)since it is needed for my work i would appreciate if anyone can help me with this question i have two ndarrays of 1000 elements each and want to copy all elements from srcarray to destarray srcarray=numpy.a

Converting a bidimensional list in a bidimensional array

2008-01-08 Thread Santiago Romero
Hi :) First of all, I must apologize for my poor english :) I'm starting with python and pygame and for testing (and learning) purposes I wrote an small "Map Editor" for a small game project I'm going to start next month. The tilemap editor is working fine, but reading Guido's Van Rossum PY

Re: use fileinput to read a specific line

2008-01-08 Thread Hrvoje Niksic
Fredrik Lundh <[EMAIL PROTECTED]> writes: > From what I can tell, Java's GC automatically closes file streams, > so Jython will behave pretty much like CPython in most cases. The finalizer does close the reclaimed streams, but since it is triggered by GC, you have to wait for GC to occur for the

Re: Look for a string on a file and get its line number

2008-01-08 Thread Horacius ReX
Hi, thanks for the help. Then I got running the following code; #!/usr/bin/env python import os, sys, re, string, array, linecache, math nlach = 12532 lach_list = sys.argv[1] lach_list_file = open(lach_list,"r") lach_mol2 = sys.argv[2] # name of the lachand mol2 file lach_mol2_file = open(lach_

Re: Passing contextual information when logging

2008-01-08 Thread Vinay Sajip
On 8 Jan, 09:46, Antoine Pitrou <[EMAIL PROTECTED]> wrote: > One question : why does the exception() method call Logger.error() rather than > Logger.exception() ? exception() is a convenience method which adds the keyword argument exc_info=1 to append traceback information to the log. Both excepti

Re: use fileinput to read a specific line

2008-01-08 Thread Martin Marcher
Fredrik Lundh wrote: > Martin Marcher wrote: > >>> i need to read line 4 from a header file >> >> http://docs.python.org/lib/module-linecache.html > > I guess you missed the "using linecache will crash my computer due to > memory loading, because i am working on 2000 files each is 8mb" part. o

Re: windows service

2008-01-08 Thread kyosohma
On Jan 7, 6:42 pm, Michael Chesterton <[EMAIL PROTECTED]> wrote: > I'm trying to get a program that uses M2Crypto ThreadingSSLServer to > run in windows as a service. I have a few problem, it doesn't listen > on its port and I don't know how to debug it. > > I used the pipeservice example as a fram

Hot clips,great clips:

2008-01-08 Thread [EMAIL PROTECTED]
Hot clips,great clips: http://groups.google.com/group/greatclips/web/great-clips -- http://mail.python.org/mailman/listinfo/python-list

Re: use fileinput to read a specific line

2008-01-08 Thread Fredrik Lundh
Steven D'Aprano wrote: > Python guarantees[1] that files will be closed, but doesn't specify when > they will be closed. I understand that Jython doesn't automatically close > files until the program terminates, so even if you could rely on the ref > counter to close the files in CPython, it wo

Re: use fileinput to read a specific line

2008-01-08 Thread Scott David Daniels
Russ P. wrote: > On Jan 7, 9:41 pm, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: >> Given that the OP is talking 2000 files to be processed, I think I'd >> recommend explicit open() and close() calls to avoid having lots of I/O >> structures floating around... >> [effectively] >> for fid in

Re: Look for a string on a file and get its line number

2008-01-08 Thread Tim Chase
>> I have to search for a string on a big file. Once this string >> is found, I would need to get the number of the line in which >> the string is located on the file. Do you know how if this is >> possible to do in python ? > > This should be reasonable: > for num, line in enumerate(open

Re: use fileinput to read a specific line

2008-01-08 Thread Steven D'Aprano
On Mon, 07 Jan 2008 22:16:56 -0800, Russ P. wrote: > One second thought, I wonder if the reference counting mechanism would > be "smart" enough to automatically close the previous file on each > iteration of the outer loop. If so, the files don't need to be > explicitly closed. Python guarantees[

Re: Open a List of Files

2008-01-08 Thread Hrvoje Niksic
Fredrik Lundh <[EMAIL PROTECTED]> writes: > BJ Swope wrote: > >> the code looks ok. please define "not working". >> >> Yep, defining "not working" is always helpful! :) >> >> I want to have all 3 files open at the same time. I will write to >> each of the files later in my script but just th

=?ISO-8859-1?Q?Intranet_Project_-_Rad_Or_Waterfall??=

2008-01-08 Thread bs866806
I have often used the analogy of building a bridge to explain to business colleagues the difference between Rapid Application Development (RAD) and Waterfall. Let's say that we are in the middle ages and the Mayor of Kingston- upon-Thames is evaluating whether or not to build a bridge over the riv

Re: Look for a string on a file and get its line number

2008-01-08 Thread Jeroen Ruigrok van der Werven
-On [20080108 12:59], Wildemar Wildenburger ([EMAIL PROTECTED]) wrote: >Style note: >May I suggest enumerate (I find the explicit counting somewhat clunky) >and maybe turning it into a generator (I like generators): Sure, I still have a lot to discover myself with Python. I'

Re: Open a List of Files

2008-01-08 Thread Fredrik Lundh
BJ Swope wrote: > the code looks ok. please define "not working". > > Yep, defining "not working" is always helpful! :) > > I want to have all 3 files open at the same time. I will write to each > of the files later in my script but just the last file is open for writing. to keep more th

Re: Open a List of Files

2008-01-08 Thread Neil Cerutti
On Jan 8, 2008 6:54 AM, BJ Swope <[EMAIL PROTECTED]> wrote: > > > given a list such as > > > > > > ['messages', 'recipients', 'viruses'] > > > > > > how would I iterate over the list and use the values as variables and > > > open the variable names a files? > > > > > > I tried > > > > > > for outfi

Re: Open a List of Files

2008-01-08 Thread Martin Marcher
BJ Swope wrote: > On Jan 8, 2008 6:03 AM, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > >> BJ Swope wrote: >> >> > given a list such as >> > >> > ['messages', 'recipients', 'viruses'] >> > >> > how would I iterate over the list and use the values as variables and >> > open the variable names a files

Re: Open a List of Files

2008-01-08 Thread Chris
On Jan 8, 1:03 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > BJ Swope wrote: > > given a list such as > > > ['messages', 'recipients', 'viruses'] > > > how would I iterate over the list and use the values as variables and > > open the variable names a files? > > > I tried > > > for outfile in ['me

Re: popen question

2008-01-08 Thread Hrvoje Niksic
Robert Latest <[EMAIL PROTECTED]> writes: >> If you see lines one by one, you are in luck, and you can fix things >> on the Python level simply by avoiding buffering in popen. If not, >> you will need to resort to more advanced hackery (e.g. fixing stdio >> using LD_PRELOAD). > > Do I really? Aft

Re: Look for a string on a file and get its line number

2008-01-08 Thread Wildemar Wildenburger
Jeroen Ruigrok van der Werven wrote: > line_nr = 0 > for line in big_file: > line_nr += 1 > has_match = line.find('my-string') > if has_match > 0: > print 'Found in line %d' % (line_nr) > Style note: May I suggest enumerate (I find the explicit counting somewhat clunky) and ma

Re: Open a List of Files

2008-01-08 Thread BJ Swope
On Jan 8, 2008 6:03 AM, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > BJ Swope wrote: > > > given a list such as > > > > ['messages', 'recipients', 'viruses'] > > > > how would I iterate over the list and use the values as variables and > > open the variable names a files? > > > > I tried > > > > for

Re: Open a List of Files

2008-01-08 Thread John Machin
On Jan 8, 10:03 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > BJ Swope wrote: > > given a list such as > > > ['messages', 'recipients', 'viruses'] > > > how would I iterate over the list and use the values as variables and > > open the variable names a files? > > > I tried > > > for outfile in ['m

Re: Passing contextual information when logging

2008-01-08 Thread Antoine Pitrou
Hi Vinay, > I would welcome your views on whether the LoggerAdapter class is > suitable for adding to the logging package in Python 2.6/3.0. Does it > do what might reasonably be expected out of the box? I think it's quite suited to the problem, yes. One question : why does the exception() meth

  1   2   >