Re: Python IDE/Eclipse

2011-08-28 Thread flebber
On Aug 27, 6:34 pm, UncleLaz wrote: > On Aug 26, 5:18 pm, Dave Boland wrote: > > > > > > > > > > > I'm looking for a good IDE -- easy to setup, easy to use -- for Python. > >   Any suggestions? > > > I use Eclipse for other projects and have no problem with using it for > > Python, except that I

On re / regex replacement

2011-08-28 Thread jmfauth
There is actually a discussion on the dev-list about the replacement of "re" by "regex". I'm not a regular expressions specialist, neither a regex user. However, there is in regex a point that is a little bit disturbing me. The regex module proposes a flag to select the "coding" (wrong word, just

Re: Record seperator

2011-08-28 Thread greymaus
On 2011-08-27, Steven D'Aprano wrote: > greymaus wrote: > >> On 2011-08-26, D'Arcy J.M. Cain wrote: >>> On 26 Aug 2011 18:39:07 GMT >>> greymaus wrote: Is there an equivelent for the AWK RS in Python? as in RS='\n\n' will seperate a file at two blank line interva

inpipe and outpipe (and other useful functions)

2011-08-28 Thread Ole Martin Bjørndalen
Hi! Please excuse me if this i common knowledge, or if I've one again re-implemented something that turned out to be in the standard library, but I think I came up with something rather neat. I'm writing a lot of programs that call external programs, and as much as I love subproces.Popen, I do ge

pyzmail-0.9.0: high level mail library to read, write and send emails easily

2011-08-28 Thread aspineux
Python easy mail library pyzmail is a high level mail library for Python. It provides functions and classes that help to read, compose and send emails. pyzmail exists because their is no reasons that handling mails with Python would be more difficult than with popular mail clients like Outlook or

Re: Python IDE/Eclipse

2011-08-28 Thread Alec Taylor
Editra On Sun, Aug 28, 2011 at 5:56 PM, flebber wrote: > On Aug 27, 6:34 pm, UncleLaz wrote: >> On Aug 26, 5:18 pm, Dave Boland wrote: >> >> >> >> >> >> >> >> >> >> > I'm looking for a good IDE -- easy to setup, easy to use -- for Python. >> >   Any suggestions? >> >> > I use Eclipse for other

Re: On re / regex replacement

2011-08-28 Thread Vlastimil Brom
2011/8/28 jmfauth : > There is actually a discussion on the dev-list about the replacement > of "re" by "regex". >... > If I can undestand the ASCII flag, ASCII being the "lingua franca" of > almost all codings, I am more skeptical about the LOCALE/UNICODE > flags. > > There is in my mind some kind

Re: Why do closures do this?

2011-08-28 Thread Thomas Jollans
On 28/08/11 05:45, John O'Hagan wrote: > Somewhat apropos of the recent "function principle" thread, I was recently > surprised by this: > > funcs=[] > for n in range(3): > def f(): > return n > funcs.append(f) > > [i() for i in funcs] > > The last expression, IMO surprisingly,

Re: Why do closures do this?

2011-08-28 Thread Terry Reedy
On 8/28/2011 10:04 AM, Thomas Jollans wrote: This does not do what you'd like it to do. But let's assume that, it did, that Python, when encountering a function definition inside a function, "froze" the values of nonlocal variables used in the new function, from the point of view of that functio

about if __name == '__main__':

2011-08-28 Thread Amit Jaluf
hello group i have one question about this if __name == '__main__': is it same as other languages like[c,c++] main function. because of i google and read faqs and also " http://docs.python.org/faq/programming#how-do-i-find-the-current-module-name"; this and i am confused. thanks -- http://m

Re: Understanding .pth files

2011-08-28 Thread Ian Kelly
On Sat, Aug 27, 2011 at 10:42 AM, Josh English wrote: > According to the docs, I should be able to put a file in the site-packages > directory called xmldb.pth pointing anywhere else on my drive to include the > package. I'd like to use this to direct Python to include the version in the > dev

Re: about if __name == '__main__':

2011-08-28 Thread Ian Kelly
On Sun, Aug 28, 2011 at 9:34 AM, Amit Jaluf wrote: > hello group > > i have one question about this > > if __name == '__main__': First, it should be: if __name__ == '__main__': > is it same as other languages like[c,c++]  main function. because of i > google and read faqs > and also " > http:/

A question about class as an iterator

2011-08-28 Thread Yaşar Arabacı
Hi, I got confused about classes as an iterator. I saw something like this: class foo(): __iter__(self): return self next(self): return something But then I saw a __next__ method on some code. So what is the deal, which one should I use and what is the difference? -- ht

Re: On re / regex replacement

2011-08-28 Thread MRAB
On 28/08/2011 14:40, Vlastimil Brom wrote: 2011/8/28 jmfauth: There is actually a discussion on the dev-list about the replacement of "re" by "regex". ... If I can undestand the ASCII flag, ASCII being the "lingua franca" of almost all codings, I am more skeptical about the LOCALE/UNICODE flags.

Re: about if __name == '__main__':

2011-08-28 Thread woooee
Two main routines, __main__ and main(), is not the usual or the common way to do it. It is confusing and anyone looking at the end of the program for statements executed when the program is called will find an isolated call to main(), and then have to search the program for the statements that sho

Re: Processing a large string

2011-08-28 Thread Paul Rudin
goldtech writes: > Hi, > > Say I have a very big string with a pattern like: > > akakksssk3dhdhdhdbddb3dkdkdkddk3dmdmdmd3dkdkdkdk3asnsn. > > I want to split the sting into separate parts on the "3" and process > each part separately. I might run into memory limitations if I use > "split" and

Fwd: Processing a large string

2011-08-28 Thread Yaşar Arabacı
-- Yönlendirilmiş ileti -- Kimden: Yaşar Arabacı Tarih: 28 Ağustos 2011 22:51 Konu: Re: Processing a large string Kime: Paul Rudin Are you getting Overflow error or memory error? If you don't know what those means: Overflow error occurs when your lists gets bigger than sys.maxs

Re: Why do closures do this?

2011-08-28 Thread Carl Banks
On Saturday, August 27, 2011 8:45:05 PM UTC-7, John O'Hagan wrote: > Somewhat apropos of the recent "function principle" thread, I was recently > surprised by this: > > funcs=[] > for n in range(3): > def f(): > return n > funcs.append(f) > > [i() for i in funcs] > > The last ex

Checking Signature of Function Parameter

2011-08-28 Thread Travis Parks
I am trying to write an algorithms library in Python. Most of the functions will accept functions as parameters. For instance, there is a function called any: def any(source, predicate): for item in source: if predicate(item): return true; return false; There are some

Re: A question about class as an iterator

2011-08-28 Thread Terry Reedy
On 8/28/2011 1:22 PM, Yaşar Arabacı wrote: I got confused about classes as an iterator. I saw something like this: class foo(): __iter__(self): return self next(self): return something 2.x But then I saw a __next__ method on some code. 3.x This might work in 2.

Re: Checking Signature of Function Parameter

2011-08-28 Thread Chris Angelico
On Mon, Aug 29, 2011 at 7:20 AM, Travis Parks wrote: > > if source is None: raise ValueError("") > if not isinstanceof(source, collections.iterable): raise TypeError("") > if not callable(predicate): raise TypeError("") > Easier: Just ignore the possibilities of failure and carry on with your cod

Re: about if __name == '__main__':

2011-08-28 Thread Terry Reedy
On 8/28/2011 2:56 PM, woooee wrote: Two main routines, __main__ and main(), '__main__' in not a routine, it is the name of the initial module. is not the usual or the common way to do it. It is confusing and anyone looking at the end of the program for statements executed when the program is

Re: Why PyImport_ExecCodeModule takes char*?

2011-08-28 Thread Tim Roberts
Mateusz Loskot wrote: > >I'm wondering, why PyImport_ExecCodeModule function takes char* >instead of const char*? My guess is "history". -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: about if __name == '__main__':

2011-08-28 Thread Ian Kelly
On Sun, Aug 28, 2011 at 12:56 PM, woooee wrote: > Two main routines, __main__ and main(), is not the usual or the common > way to do it.  It is confusing and anyone looking at the end of the > program for statements executed when the program is called will find > an isolated call to main(), and th

Re: about if __name == '__main__':

2011-08-28 Thread Cameron Simpson
On 28Aug2011 11:56, woooee wrote: | Two main routines, __main__ and main(), is not the usual or the common | way to do it. It is confusing and anyone looking at the end of the | program for statements executed when the program is called will find | an isolated call to main(), and then have to sea

Re: Why PyImport_ExecCodeModule takes char*?

2011-08-28 Thread Terry Reedy
On 8/28/2011 6:52 PM, Tim Roberts wrote: Mateusz Loskot wrote: I'm wondering, why PyImport_ExecCodeModule function takes char* instead of const char*? My guess is "history". I believe some const tags have been added over the last few years. Another factory than mere history for some thing

Unpickle error -- "object has no attribute ...."

2011-08-28 Thread luvspython
I have an application that needs to keep a history of the values of several attributes of each of many instances of many classes. The history-keeping logic is in a helper class, HistoryKeeper, that's inherited by classes like Vehicle in the example below. Pickling an instance of Vehicle works, bu

Re: Checking Signature of Function Parameter

2011-08-28 Thread Travis Parks
On Aug 28, 5:31 pm, Chris Angelico wrote: > On Mon, Aug 29, 2011 at 7:20 AM, Travis Parks wrote: > > > if source is None: raise ValueError("") > > if not isinstanceof(source, collections.iterable): raise TypeError("") > > if not callable(predicate): raise TypeError("") > > Easier: Just ignore the

Re: Checking Signature of Function Parameter

2011-08-28 Thread Chris Angelico
On Mon, Aug 29, 2011 at 10:20 AM, Travis Parks wrote: > Maybe I should give up on it, like you said. I am still familiarizing > myself with the paradigm. I want to make sure I am developing code > that is consistent with the industry standards. > In Python, the industry standard is "easier to ask

Why I need the parameter when the call doesn't use it?

2011-08-28 Thread Niklas Rosencrantz
I modularize code for a webapp and I want to know what python makes that a need to define an argument called self? Here's some code where I'm modularizing a recaptcha test to a function and the I must add the parameter "self" to the function is_submitter_human: class A(BaseHandler, blobsto

Some problems refer to install 3rd party package of Python on mac OS 10.6.8

2011-08-28 Thread Gee Chen
-- the Python environment on my mac is: Python 2.6.4 (r264:75706, Aug 28 2011, 22:29:24) [GCC 4.2.1 (Apple Inc. build 5664)] on darwin i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5664) Copyright (C) 2007 Free Software Foundation, Inc. --

Re: Checking Signature of Function Parameter

2011-08-28 Thread Ian Kelly
On Sun, Aug 28, 2011 at 3:20 PM, Travis Parks wrote: > I am trying to write an algorithms library in Python. Most of the > functions will accept functions as parameters. For instance, there is > a function called any: > > def any(source, predicate): >    for item in source: >        if predicate(i

Re: Some problems refer to install 3rd party package of Python on mac OS 10.6.8

2011-08-28 Thread Chris Rebert
On Sun, Aug 28, 2011 at 5:35 PM, Gee Chen wrote: > -- > the Python environment on my mac is: > > Python 2.6.4 (r264:75706, Aug 28 2011, 22:29:24) > [GCC 4.2.1 (Apple Inc. build 5664)] on darwin For future reference, when on OS X, it's very helpful to include how yo

Re: Checking Signature of Function Parameter

2011-08-28 Thread Chris Rebert
On Sun, Aug 28, 2011 at 2:20 PM, Travis Parks wrote: > I am trying to write an algorithms library in Python. Most of the > functions will accept functions as parameters. For instance, there is > a function called any: > > def any(source, predicate): >    for item in source: >        if predicate(i

killing a script

2011-08-28 Thread Russ P.
I have a Python (2.6.x) script on Linux that loops through many directories and does processing for each. That processing includes several "os.system" calls for each directory (some to other Python scripts, others to bash scripts). Occasionally something goes wrong, and the top-level script just k

Re: Why I need the parameter when the call doesn't use it?

2011-08-28 Thread Ben Finney
Niklas Rosencrantz writes: > I modularize code for a webapp and I want to know what python makes > that a need to define an argument called self? Because, when calling a method on an instance, the instance is a parameter to the call. That is, foo = Thribble() foo.bar("spam") is usually

Re: [Python] Why I need the parameter when the call doesn't use it?

2011-08-28 Thread Chris Gonnerman
On 08/28/2011 07:26 PM, Niklas Rosencrantz wrote: I modularize code for a webapp and I want to know what python makes that a need to define an argument called self? Here's some code where I'm modularizing a recaptcha test to a function and the I must add the parameter "self" to the function is

Button Label change on EVT_BUTTON in wxpython!!!

2011-08-28 Thread Ven
Some system info before proceeding further: Platform: Mac OS X 10.7.1 Python Version: ActiveState Python 2.7.1 wxPython Version: [url=http://downloads.sourceforge.net/wxpython/ wxPython2.9-osx-2.9.2.1-cocoa-py2.7.dmg]wxPython2.9-osx-cocoa-py2.7[/ url] I want the button label to be changed while p

Re: Why I need the parameter when the call doesn't use it?

2011-08-28 Thread Chris Rebert
On Sun, Aug 28, 2011 at 5:26 PM, Niklas Rosencrantz wrote: > I modularize code for a webapp and I want to know what python makes that a > need to define an argument called self? Here's some code where I'm > modularizing a recaptcha test to a function and the I must add the parameter > "self" to

Re: killing a script

2011-08-28 Thread MRAB
On 29/08/2011 02:15, Russ P. wrote: I have a Python (2.6.x) script on Linux that loops through many directories and does processing for each. That processing includes several "os.system" calls for each directory (some to other Python scripts, others to bash scripts). Occasionally something goes

Re: Button Label change on EVT_BUTTON in wxpython!!!

2011-08-28 Thread Philip Semanchuk
On Aug 28, 2011, at 9:30 PM, Ven wrote: > Some system info before proceeding further: > > Platform: Mac OS X 10.7.1 > Python Version: ActiveState Python 2.7.1 > wxPython Version: [url=http://downloads.sourceforge.net/wxpython/ > wxPython2.9-osx-2.9.2.1-cocoa-py2.7.dmg]wxPython2.9-osx-cocoa-py2.7

Re: [Python] Why I need the parameter when the call doesn't use it?

2011-08-28 Thread Ben Finney
Chris Gonnerman writes: > On 08/28/2011 07:26 PM, Niklas Rosencrantz wrote: > > class A(BaseHandler, blobstore_handlers.BlobstoreUploadHandler): > > def is_submitter_human(self): > is_submitter_human() isn't a function, it's a method. No, that's not true and may lead to future confusion.

Re: killing a script

2011-08-28 Thread Russ P.
On Aug 28, 6:52 pm, MRAB wrote: > On 29/08/2011 02:15, Russ P. wrote:> I have a Python (2.6.x) script on Linux > that loops through many > > directories and does processing for each. That processing includes > > several "os.system" calls for each directory (some to other Python > > scripts, other

Re: killing a script

2011-08-28 Thread Chris Angelico
On Mon, Aug 29, 2011 at 12:41 PM, Russ P. wrote: > On Aug 28, 6:52 pm, MRAB wrote: >> You could look at the return value of os.system, which may tell you the >> exit status of the process. > > Thanks for the suggestion. Yeah, I guess I could do that, but it seems > that there should be a simpler

Re: killing a script

2011-08-28 Thread Paul Rubin
"Russ P." writes: > Thanks for the suggestion. Yeah, I guess I could do that, but it seems > that there should be a simpler way to just kill the "whole enchilada." > Hitting Control-C over and over is a bit like whacking moles. Hit Ctrl-Z, which stops execution of the subprogram but doesn't kill

Re: [ANN] Oktest 0.9.0 released - a new-style testing library

2011-08-28 Thread Makoto Kuwata
I published presentation slide about Oktest. If you have interested in testing, check it out. http://www.slideshare.net/kwatch/oktest-a-new-style-testing-library-for-python -- regards, makoto kuwata On Sat, Aug 27, 2011 at 9:37 PM, Makoto Kuwata wrote: > Hi, > > I released Oktest 0.9.0. > htt

Re: killing a script

2011-08-28 Thread Russ P.
On Aug 28, 7:51 pm, Chris Angelico wrote: > On Mon, Aug 29, 2011 at 12:41 PM, Russ P. wrote: > > On Aug 28, 6:52 pm, MRAB wrote: > >> You could look at the return value of os.system, which may tell you the > >> exit status of the process. > > > Thanks for the suggestion. Yeah, I guess I could do

Re: killing a script

2011-08-28 Thread Chris Rebert
On Sun, Aug 28, 2011 at 8:08 PM, Russ P. wrote: > On Aug 28, 7:51 pm, Chris Angelico wrote: >> On Mon, Aug 29, 2011 at 12:41 PM, Russ P. wrote: >> > On Aug 28, 6:52 pm, MRAB wrote: >> >> You could look at the return value of os.system, which may tell you the >> >> exit status of the process. >>

Re: killing a script

2011-08-28 Thread Russ P.
On Aug 28, 8:16 pm, Chris Rebert wrote: > On Sun, Aug 28, 2011 at 8:08 PM, Russ P. wrote: > > On Aug 28, 7:51 pm, Chris Angelico wrote: > >> On Mon, Aug 29, 2011 at 12:41 PM, Russ P. wrote: > >> > On Aug 28, 6:52 pm, MRAB wrote: > >> >> You could look at the return value of os.system, which ma

Re: Why I need the parameter when the call doesn't use it?

2011-08-28 Thread John Gordon
In <66a3f64c-d35e-40c7-be69-ddf708e37...@glegroupsg2000goo.googlegroups.com> Niklas Rosencrantz writes: > What's the story of using these parameters that are called "self"? "self" is a reference to the class object, and it allows the method to access other methods and variables within the class

Re: about if __name == '__main__':

2011-08-28 Thread Amit Jaluf
On Aug 28, 12:51 pm, Ian Kelly wrote: > On Sun, Aug 28, 2011 at 9:34 AM, Amit Jaluf wrote: > > hello group > > > i have one question about this > > > if __name == '__main__': sorry dear for this and thanks all of you for this -- http://mail.python.org/mailman/listinfo/python-lis

Re: packaging a python application

2011-08-28 Thread anand jeyahar
Hi all, This is interesting. Do we have the distribute/setuptools equivalent of postinstall (with ncurses interface) from Debian? My limited foray into setuptools, indicate it doesn't have . Is it a planned feature either? i would like to contribute in that case. ==

Re: [Python] Why I need the parameter when the call doesn't use it?

2011-08-28 Thread Steven D'Aprano
On Mon, 29 Aug 2011 12:34 pm Ben Finney wrote: > Chris Gonnerman writes: > >> On 08/28/2011 07:26 PM, Niklas Rosencrantz wrote: >> > class A(BaseHandler, blobstore_handlers.BlobstoreUploadHandler): >> > def is_submitter_human(self): > >> is_submitter_human() isn't a function, it's a method

Interact with SQL Database using Python 2.4 or lower

2011-08-28 Thread Sascha
Hello I have an website on an Australian webhost. I have designed my website to allow people to login & their login details are stored in an SQLite3 database. I interact with the SQLite3 database using pythons SQLite3 module(found only in python2.5 & up) My Problem: the webhost runs Python 2.4 so

Re: Interact with SQL Database using Python 2.4 or lower

2011-08-28 Thread Stephen Hansen
On 8/28/11 9:49 PM, Sascha wrote: > My Problem: the webhost runs Python 2.4 so I cannot communicate > with(query or modify) my SQLite3 database. The webhost will not allow > me to install my own version of python or upload modules unless I > upgrade to VPS. Get a new webhost. Seriously. This is a

Re: Interact with SQL Database using Python 2.4 or lower

2011-08-28 Thread Chris Angelico
On Mon, Aug 29, 2011 at 3:09 PM, Stephen Hansen wrote: > Get a new webhost. ... > > But I don't know if they have a warehouse in Australia, if their latency > with any of their various data centers is suitable for you. Maybe, maybe > not -- but there /has/ to be a better option then this site... G

Re: Interact with SQL Database using Python 2.4 or lower

2011-08-28 Thread Stephen Hansen
On 8/28/11 10:23 PM, Chris Angelico wrote: > On Mon, Aug 29, 2011 at 3:09 PM, Stephen Hansen > wrote: >> Get a new webhost. ... >> >> But I don't know if they have a warehouse in Australia, if their latency >> with any of their various data centers is suitable for you. Maybe, maybe >> not -- but t

Re: On re / regex replacement

2011-08-28 Thread jmfauth
On 28 août, 20:40, MRAB wrote: > ... > The regex module tries to be drop-in compatible. It supports the LOCALE > flag only because the re module has it. Even Perl has something similar. > ... Ok. That's quite logical. jmf -- http://mail.python.org/mailman/listinfo/python-list

Web hosting when you need to install your own modules (was Re: Interact with SQL Database using Python 2.4 or lower)

2011-08-28 Thread Chris Angelico
On Mon, Aug 29, 2011 at 3:39 PM, Stephen Hansen wrote: > Just don't get too tied to a certain host until you feel them out. > Sending them emails with detailed questions before you sign up is a good > thing, for example. > That helps a lot, but the problems I had with my most recent pay-for web h

Re: Web hosting when you need to install your own modules (was Re: Interact with SQL Database using Python 2.4 or lower)

2011-08-28 Thread Stephen Hansen
On 8/28/11 10:52 PM, Chris Angelico wrote: > * DNS record changes required a support ticket (this was shared web > hosting, so I didn't have control over the BIND files - that's what > they said, anyway) Ouch: I never let a webhost near my domain names. I was burned somewhere around that a long ti

Re: Why I need the parameter when the call doesn't use it?

2011-08-28 Thread Ben Finney
John Gordon writes: > In <66a3f64c-d35e-40c7-be69-ddf708e37...@glegroupsg2000goo.googlegroups.com> > Niklas Rosencrantz writes: > > > What's the story of using these parameters that are called "self"? > > "self" is a reference to the class object, and it allows the method to > access other meth

Re: Checking Signature of Function Parameter

2011-08-28 Thread Nobody
On Sun, 28 Aug 2011 14:20:11 -0700, Travis Parks wrote: > More importantly, I want to make sure that > predicate is callable, accepting a thing, returning a bool. The "callable" part is do-able, the rest isn't. The predicate may accept an arbitrary set of arguments via the "*args" and/or "**kwar

Re: killing a script

2011-08-28 Thread Nobody
On Sun, 28 Aug 2011 18:15:56 -0700, Russ P. wrote: > Is there a > simple way to ensure that the first Control-C will kill the whole darn > thing, i.e, the top-level script? Thanks. You might try using subprocess.Popen() or subprocess.call() rather than os.system(). os.system() calls the platform