argparse zero-length switch

2011-10-13 Thread Carl Banks
Is it possible to specify a zero-length switch? Here's what I mean. I have a use case where some users would have to enter a section name on the command line almost every time, whereas other users (the ones using only one section) will never have to enter the section name. I don't want to burd

Re: Looking for browser emulator

2011-10-13 Thread Roy Smith
In article , Gary Herron wrote: > Try mechanize >http://wwwsearch.sourceforge.net/mechanize/ > billed as >Stateful programmatic web browsing in Python. Wow, this is cool, thanks! It even does cookies! -- http://mail.python.org/mailman/listinfo/python-list

Re: Looking for browser emulator

2011-10-13 Thread Gary Herron
On 10/13/2011 07:19 PM, Roy Smith wrote: I've got to write some tests in python which simulate getting a page of HTML from an http server, finding a link, clicking on it, and then examining the HTML on the next page to make sure it has certain features. I can use urllib to do the basic fetching,

Re: Looking for browser emulator

2011-10-13 Thread Miki Tebeka
IIRC mechanize can do that. -- http://mail.python.org/mailman/listinfo/python-list

Re: Looking for browser emulator

2011-10-13 Thread Roy Smith
In article <2323f3d7-42ff-4de5-9006-4741e865f...@a9g2000yqo.googlegroups.com>, Jon Clements wrote: > On Oct 14, 3:19 am, Roy Smith wrote: > > I've got to write some tests in python which simulate getting a page of > > HTML from an http server, finding a link, clicking on it, and then > > exami

Re: Looking for browser emulator

2011-10-13 Thread Jon Clements
On Oct 14, 3:19 am, Roy Smith wrote: > I've got to write some tests in python which simulate getting a page of > HTML from an http server, finding a link, clicking on it, and then > examining the HTML on the next page to make sure it has certain features. > > I can use urllib to do the basic fetch

Re: Looking for browser emulator

2011-10-13 Thread Jon Clements
On Oct 14, 3:19 am, Roy Smith wrote: > I've got to write some tests in python which simulate getting a page of > HTML from an http server, finding a link, clicking on it, and then > examining the HTML on the next page to make sure it has certain features. > > I can use urllib to do the basic fetch

Re: Language Enhancement Idea to help with multi-processing (your opinions please)

2011-10-13 Thread Steven D'Aprano
Martin P. Hellwig wrote: > I was wondering if there could be an advantage to add another control > flow statement. > For the purpose of this writing let's say "ooo" which stands for 'out of > order'. [...] > What I would expect to happen that all statements within the ooo block > may be executed o

Looking for browser emulator

2011-10-13 Thread Roy Smith
I've got to write some tests in python which simulate getting a page of HTML from an http server, finding a link, clicking on it, and then examining the HTML on the next page to make sure it has certain features. I can use urllib to do the basic fetching, and lxml gives me the tools to find the

Re: [Python-ideas] Implement comparison operators for range objects

2011-10-13 Thread 88888 dihedral
How about iterable objects supported in python? Is a countable object iterable definitely? Also the tail recursion technique is useful for the same function with few arguments that calls itself. The lisp compiler would emit machine codes with fast jumps and passing arguments in registers or

Re: Reading a file into a data structure....

2011-10-13 Thread Jon Clements
On Oct 13, 10:59 pm, MrPink wrote: > This is a continuing to a post I made in > August:http://groups.google.com/group/comp.lang.python/browse_thread/thread/... > > I got some free time to work with Python again and have some followup > questions. > > For example, I have a list in a text file like

Re: Reading a file into a data structure....

2011-10-13 Thread Ian Kelly
On Thu, Oct 13, 2011 at 3:59 PM, MrPink wrote: > This is a continuing to a post I made in August: > http://groups.google.com/group/comp.lang.python/browse_thread/thread/b072cfadf998deae/ce6d4d09911e4107?lnk=gst&q=MrPink#ce6d4d09911e4107 > > I got some free time to work with Python again and have s

Re: Language Enhancement Idea to help with multi-processing (your opinions please)

2011-10-13 Thread Neil Hodgson
jkn: > FWIW, this looks rather like the 'PAR' construct of Occam to me. > > http://en.wikipedia.org/wiki/Occam_%28programming_language%29 Earlier than that, 'par' is from Algol 68: http://en.wikipedia.org/wiki/ALGOL_68#par:_Parallel_processing Neil -- http://mail.python.org/mailman/listi

Re: Language Enhancement Idea to help with multi-processing (your opinions please)

2011-10-13 Thread Rhodri James
On Thu, 13 Oct 2011 15:33:27 +0100, jkn wrote: FWIW, this looks rather like the 'PAR' construct of Occam to me. http://en.wikipedia.org/wiki/Occam_%28programming_language%29 I was going to say the same thing. Occam's answer to Stefan's question about what to do if you want more than one sta

Re: Opportunity missed by Python ?

2011-10-13 Thread 88888 dihedral
As long as there are tools to translate scripts or source code between the two languages. More new evolved powerful programming languages arenot problems at all for experienced programmers. -- http://mail.python.org/mailman/listinfo/python-list

Reading a file into a data structure....

2011-10-13 Thread MrPink
This is a continuing to a post I made in August: http://groups.google.com/group/comp.lang.python/browse_thread/thread/b072cfadf998deae/ce6d4d09911e4107?lnk=gst&q=MrPink#ce6d4d09911e4107 I got some free time to work with Python again and have some followup questions. For example, I have a list in

Re: Opportunity missed by Python ?

2011-10-13 Thread Chris Angelico
On Fri, Oct 14, 2011 at 8:38 AM, BartC wrote: > The entire resources of Google available, and they re-invent C! Syntactically, C has a lot going for it. If you want to invent a new language and have developers grok it easily, borrowing syntax from C will help a lot. But in this case, I think the

Re: Opportunity missed by Python ?

2011-10-13 Thread BartC
"candide" wrote in message news:4e96b324$0$1007$426a3...@news.free.fr... Dart is the very new language created by Google to replace Javascript. So Python was not able to do the job? Or may be they don't know about Python at Google ;) ? The entire resources of Google available, and they re-

Re: Language Enhancement Idea to help with multi-processing (your opinions please)

2011-10-13 Thread Martin P. Hellwig
On 13/10/2011 15:13, Stefan Behnel wrote: Martin P. Hellwig, 13.10.2011 14:35: I was wondering if there could be an advantage to add another control flow statement. Changes at that level must be very well justified, are often rejected for the reason of being not too complicated to write in som

RE: Dynamically altering __init__

2011-10-13 Thread Kääriäinen Anssi
Ian Kelly wrote: """ You can either pull the function code object out of the module code object constants: ... st_code = parser.compilest(st) func_code = st_code.co_consts[0] f = types.FunctionType(func_code, {}, '__init__') ... But you should take care to ensure that the function code object act

Re: Dynamically altering __init__

2011-10-13 Thread Ian Kelly
2011/10/13 Kääriäinen Anssi : > import parser > import types > st = parser.suite(src) > dyn_func = parser.compilest(st) > f = types.FunctionType(dyn_func, {}, '__init__') > im = types.MethodType(f, None, Foo) > Foo() > Foo.__init__ = im > Foo(1, 2, 3) > > The result is: TypeError: () takes no argum

Re: 1/2 evaluates to 0

2011-10-13 Thread Laurent Claessens
You should get in touch with the Sage developers. In the Sage FAQ they say that "until SciPy is ported to run with Python 3.x and Cython supports Python 3.x, Sage will continue to use Python 2.x." ``scipy.weave``." So according to the Sage FAQ there is no reason why Sage shouldn't support Pyt

Re: Language Enhancement Idea to help with multi-processing (your opinions please)

2011-10-13 Thread jkn
FWIW, this looks rather like the 'PAR' construct of Occam to me. http://en.wikipedia.org/wiki/Occam_%28programming_language%29 J^n -- http://mail.python.org/mailman/listinfo/python-list

Re: Opportunity missed by Python ?

2011-10-13 Thread Westley Martínez
On Thu, Oct 13, 2011 at 09:07:09PM +1100, Chris Angelico wrote: > On Thu, Oct 13, 2011 at 8:45 PM, candide wrote: > > Dart is the very new language created by Google to replace Javascript. > > So Python was not able to do the job? Or may be they don't know about Python > > at Google ;) ? > > > >

Re: Opportunity missed by Python ?

2011-10-13 Thread Westley Martínez
On Thu, Oct 13, 2011 at 11:45:06AM +0200, candide wrote: > Dart is the very new language created by Google to replace Javascript. > So Python was not able to do the job? Or may be they don't know > about Python at Google ;) ? Google's a big supporter for Python...I think Guido working being employ

Re: MySQLdb on Mac Lion

2011-10-13 Thread Tim Johnson
* Ned Deily [111012 18:12]: > In article <20111013005244.gk6...@johnsons-web.com>, > Tim Johnson wrote: > > I'm most experienced with MySQLdb on ubuntu, which is installed via > > apt-get or synaptic. > > > > I am setting up a mac mini with osX 10.7 (Lion). Macports makes > > py27-mysql 1.2.2 a

Re: Language Enhancement Idea to help with multi-processing (your opinions please)

2011-10-13 Thread Stefan Behnel
Martin P. Hellwig, 13.10.2011 14:35: I was wondering if there could be an advantage to add another control flow statement. Changes at that level must be very well justified, are often rejected for the reason of being not too complicated to write in some other form and are close to impossible

Re: Opportunity missed by Python ?

2011-10-13 Thread Alain Ketterlin
Chris Angelico writes: > On Thu, Oct 13, 2011 at 8:45 PM, candide wrote: >> Dart is the very new language created by Google to replace Javascript. >> So Python was not able to do the job? Or may be they don't know about Python >> at Google ;) ? > > Python, as I found out to my detriment, is prac

Re: Python gp.ListFeatureClasses return only one file

2011-10-13 Thread Andreas Perstinger
On 2011-10-13 14:00, yo wrote: Hi All, I m using the gp.ListFeatureClasses to make a list of file in my directory (containing several hundreds of file) however when I print the variable in which the List is supposed to be stored, the print just return one file name does any one have an idea??

Re: Language Enhancement Idea to help with multi-processing (your opinions please)

2011-10-13 Thread Chris Angelico
On Thu, Oct 13, 2011 at 11:35 PM, Martin P. Hellwig wrote: > What I would expect to happen that all statements within the ooo block may > be executed out > of order. The block itself waits till all statements are returned before > continuing. > In a statically-typed language such as C, this can b

Re: 1/2 evaluates to 0

2011-10-13 Thread SigmundV
On Oct 13, 10:04 am, Laurent Claessens wrote: > Thanks all for your ansers. I'll import division from __future__ > Most of what I'm using in Python is with Sage[1]. Thus I'm not about to > step to 3.x :( You should get in touch with the Sage developers. In the Sage FAQ they say that "until SciPy

Language Enhancement Idea to help with multi-processing (your opinions please)

2011-10-13 Thread Martin P. Hellwig
First of all let me say that I have no authority or knowledge of language design or multi-processing except from a user point of view, having a decade or so experience. I would like your opinion and appreciate any feedback and value any hints to documentation, procedures or related ramblings :-)

Python gp.ListFeatureClasses return only one file

2011-10-13 Thread yo
Hi All, I m using the gp.ListFeatureClasses to make a list of file in my directory (containing several hundreds of file) however when I print the variable in which the List is supposed to be stored, the print just return one file name does any one have an idea # Import system modules impor

Dynamically altering __init__

2011-10-13 Thread Kääriäinen Anssi
Hello all, I am trying to alter the init method of a class by source to AST -> alter AST -> AST back to code -> f = types.FunctionType(code, {}, '__init__') -> mt = types.MethodType(f, None, Foo) -> Foo.__init__ = mt I have two problems, first I haven't yet figured out how to make the AST back to

Re: Opportunity missed by Python ?

2011-10-13 Thread Duncan Booth
candide wrote: > Dart is the very new language created by Google to replace Javascript. > So Python was not able to do the job? Or may be they don't know about > Python at Google ;) ? I take it you haven't actually looked at the Dart tools then? They're largely written in Python. -- Duncan B

Re: Opportunity missed by Python ?

2011-10-13 Thread Chris Rebert
On Thu, Oct 13, 2011 at 3:07 AM, Chris Angelico wrote: > On Thu, Oct 13, 2011 at 8:45 PM, candide wrote: >> Dart is the very new language created by Google to replace Javascript. >> So Python was not able to do the job? Or may be they don't know about Python >> at Google ;) ? >> > > Python, as I

Re: Opportunity missed by Python ?

2011-10-13 Thread Terry Reedy
On 10/13/2011 6:07 AM, Chris Angelico wrote: On Thu, Oct 13, 2011 at 8:45 PM, candide wrote: Dart is the very new language created by Google to replace Javascript. So Python was not able to do the job? Or may be they don't know about Python at Google ;) ? Python, as I found out to my detrime

Re: Embedding a "frame" into a movie using python

2011-10-13 Thread Chris Angelico
On Thu, Oct 13, 2011 at 7:51 PM, J <1jason.whatf...@gmail.com> wrote: > thank you for your response. I am format agnostic for processing so am happy > to work with avi etc., however in displaying the final film to the user I > think I'd need to convert whatever I've made to swf to make it a littl

Re: Opportunity missed by Python ?

2011-10-13 Thread Chris Angelico
On Thu, Oct 13, 2011 at 8:45 PM, candide wrote: > Dart is the very new language created by Google to replace Javascript. > So Python was not able to do the job? Or may be they don't know about Python > at Google ;) ? > Python, as I found out to my detriment, is practically impossible to sandbox e

Re: 1/2 evaluates to 0

2011-10-13 Thread Laurent Claessens
Wohaw. This means that this behavior is going to be default in a foreseeable future ? It's the default in 3.x. I can't imagine it ever being the default in 2.x. 2.7 is now in "bug-fix only" mode, so no new features, and there won't be a 2.8, so true division will never be the default in

Re: Opportunity missed by Python ?

2011-10-13 Thread Andreas Neudecker
Am 13.10.2011 11:45, schrieb candide: > Dart is the very new language created by Google to replace Javascript. > So Python was not able to do the job? Or may be they don't know about > Python at Google ;) ? What needs to be done to make Python replace JS in Browsers/HTML? (or at least make it a vi

Opportunity missed by Python ?

2011-10-13 Thread candide
Dart is the very new language created by Google to replace Javascript. So Python was not able to do the job? Or may be they don't know about Python at Google ;) ? -- http://mail.python.org/mailman/listinfo/python-list

Reading screen width of a Tkinter widget.

2011-10-13 Thread peter
I recently had a problem while trying to set up a Tkinter Canvas widget as a progress bar. Everything seemed to be working, except that at 100% completion the progress bar spanned only about 75% of the canvas width. Eventually I tracked the problem down to the canvas bar 'width' property as read

Re: Embedding a "frame" into a movie using python

2011-10-13 Thread J
>> My objective is to have the user put together some images html and embed the >> image as a frame into a video file (any embeddable format e.g. swf). >SWF isn't the easiest format to work with; it's not necessarily a video, but might be a scripted object. Try working with real video formats

Re: Usefulness of the "not in" operator

2011-10-13 Thread Jussi Piitulainen
Chris Angelico writes: > On Sun, Oct 9, 2011 at 12:07 AM, Jussi Piitulainen wrote: > > But both negations can be avoided by modus tollens. > > > > "If you are able to start the car, the key is in the ignition." > > But this translation implies looking at the result and ascertaining > the state, wh