docstringargs: Python module for setting up argparse

2015-04-19 Thread Chris Angelico
Looking for comments, recommendations, advice that I've just wasted half a day on something utterly useless, whatever it be! I've just posted a new (single-module) package to PyPI that simplifies the creation of an argparse UI for a program that consists of a number of subcommands. It uses functio

Re: New to Python - block grouping (spaces)

2015-04-19 Thread Marko Rauhamaa
Chris Angelico : > On Mon, Apr 20, 2015 at 12:54 PM, Steven D'Aprano > wrote: >> On Mon, 20 Apr 2015 06:41 am, Marko Rauhamaa wrote: >> Python has a noncanonical textual representation? >> >> What is a noncanonical textual representation, and where can I see >> some? > > I think what Marko means

Re: need help removing 'dev-r0' part from a python package

2015-04-19 Thread suren shrestha
On Monday, April 20, 2015 at 10:00:26 AM UTC+5:45, Chris Angelico wrote: > On Mon, Apr 20, 2015 at 1:57 PM, wrote: > > My package 'webpreview'[https://github.com/ludbek/webpreview] has new > > version '1.0.3'. I used 'sdist' to bundle it. Unfortunately it names it > > 'webpreview-1.0.3dev-r0.ta

Re: need help removing 'dev-r0' part from a python package

2015-04-19 Thread Ben Finney
sth@gmail.com writes: > My package 'webpreview'[https://github.com/ludbek/webpreview] has new > version '1.0.3'. I used 'sdist' to bundle it. I'll assume you are using a ‘./setup.py’ program to define and generate the distribution. The ‘setup’ function in that program takes a ‘version’ param

Re: need help removing 'dev-r0' part from a python package

2015-04-19 Thread Chris Angelico
On Mon, Apr 20, 2015 at 1:57 PM, wrote: > My package 'webpreview'[https://github.com/ludbek/webpreview] has new version > '1.0.3'. I used 'sdist' to bundle it. Unfortunately it names it > 'webpreview-1.0.3dev-r0.tar.gz' instead of 'webpreview-1.0.3.tar.gz' making > it unsuitable to upload to p

need help removing 'dev-r0' part from a python package

2015-04-19 Thread sth . srn
My package 'webpreview'[https://github.com/ludbek/webpreview] has new version '1.0.3'. I used 'sdist' to bundle it. Unfortunately it names it 'webpreview-1.0.3dev-r0.tar.gz' instead of 'webpreview-1.0.3.tar.gz' making it unsuitable to upload to pypi. What is causing sdist to append 'dev' stuff

Re: New to Python - block grouping (spaces)

2015-04-19 Thread Chris Angelico
On Mon, Apr 20, 2015 at 1:28 PM, Rustom Mody wrote: >> If you have a ten-file project that's identifying a key function >> globally as 'f', then you already have a problem. If your names are >> more useful and informative, a global search-and-replace will do the >> job. > > Are you sure your globa

Re: New to Python - block grouping (spaces)

2015-04-19 Thread Rustom Mody
On Monday, April 20, 2015 at 8:34:12 AM UTC+5:30, Chris Angelico wrote: > On Mon, Apr 20, 2015 at 12:43 PM, Rustom Mody wrote: > > The key thing to make this work is that the tab needs to be a reasonably > > solid > > non-leaky abstraction for denoting an indent. > > As soon as you allow both tab

Re: New to Python - block grouping (spaces)

2015-04-19 Thread Chris Angelico
On Mon, Apr 20, 2015 at 12:54 PM, Steven D'Aprano wrote: > On Mon, 20 Apr 2015 06:41 am, Marko Rauhamaa wrote: > >> Lisp has a noncanonical textual representation just like Python. > > Python has a noncanonical textual representation? > > What is a noncanonical textual representation, and where ca

Re: New to Python - block grouping (spaces)

2015-04-19 Thread Chris Angelico
On Mon, Apr 20, 2015 at 12:43 PM, Rustom Mody wrote: > The key thing to make this work is that the tab needs to be a reasonably solid > non-leaky abstraction for denoting an indent. > As soon as you allow both tabs and spaces all the interminable bikeshedding > starts > Whatever you change, ther

Re: New to Python - block grouping (spaces)

2015-04-19 Thread Steven D'Aprano
On Mon, 20 Apr 2015 06:41 am, Marko Rauhamaa wrote: > Lisp has a noncanonical textual representation just like Python. Python has a noncanonical textual representation? What is a noncanonical textual representation, and where can I see some? -- Steven -- https://mail.python.org/mailman/lis

Re: Best search algorithm to find condition within a range

2015-04-19 Thread Steven D'Aprano
On Mon, 20 Apr 2015 12:56 am, Marko Rauhamaa wrote: > Steven D'Aprano : > >> Yay! I'm not the only one who uses or likes Forth! > > Out of interest, is Forth different from PostScript? I have done some > small-time programming in PostScript but nothing in Forth. Both Forth and PostScript are c

Re: New to Python - block grouping (spaces)

2015-04-19 Thread Rustom Mody
On Monday, April 20, 2015 at 7:54:37 AM UTC+5:30, Chris Angelico wrote: > On Mon, Apr 20, 2015 at 12:08 PM, Rustom Mody wrote: > > Prestige of Unix development environment keeps us stuck with text files when > > the world has moved on > > And what, pray, would we gain by using non-text source cod

Re: New to Python - block grouping (spaces)

2015-04-19 Thread Steven D'Aprano
On Mon, 20 Apr 2015 04:07 am, Dan Sommers wrote: > Smalltalk, Forth, and LISP don't follow the program=textfile system > (although LISP can, and does sometimes); Correct, and the fact that they wrapped code and environment into a completely opaque image was a major factor in their decline in popu

Re: New to Python - block grouping (spaces)

2015-04-19 Thread Mark Lawrence
On 20/04/2015 03:08, Rustom Mody wrote: Prestige of Unix development environment keeps us stuck with text files when the world has moved on If it ain't broke, don't fix it. -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence

Re: New to Python - block grouping (spaces)

2015-04-19 Thread Chris Angelico
On Mon, Apr 20, 2015 at 12:08 PM, Rustom Mody wrote: > Prestige of Unix development environment keeps us stuck with text files when > the world has moved on And what, pray, would we gain by using non-text source code? Aside from binding ourselves to a set of tools, which would create an even wors

Re: New to Python - block grouping (spaces)

2015-04-19 Thread Rustom Mody
On Sunday, April 19, 2015 at 11:23:20 PM UTC+5:30, Steven D'Aprano wrote: > Programmers use source code as text for the same reason that wheels are > still round. Wheels have been round for thousands of years! Why can't we > try something modern, like triangular wheels? Or something fractal in > th

Re: New to Python - block grouping (spaces)

2015-04-19 Thread Rustom Mody
On Monday, April 20, 2015 at 2:11:13 AM UTC+5:30, Marko Rauhamaa wrote: > Michael Torrie: > > > On 04/18/2015 01:00 AM, Marko Rauhamaa wrote: > >> It would be possible to define a canonical AST storage format. Then, > >> your editor could "incarnate" the AST in the syntax of your choosing. > > > >

Re: do you guys help newbies??

2015-04-19 Thread Mark Lawrence
On 20/04/2015 02:53, Dave Angel wrote: On 04/19/2015 09:37 PM, josiah.l...@stu.nebo.edu wrote: On Wednesday, November 27, 2002 at 4:01:02 AM UTC-7, John Hunter wrote: "malik" == malik martin writes: malik>i'm having a simple problem i guess. but i still dont malik> know the an

Re: do you guys help newbies??

2015-04-19 Thread Dave Angel
On 04/19/2015 09:37 PM, josiah.l...@stu.nebo.edu wrote: On Wednesday, November 27, 2002 at 4:01:02 AM UTC-7, John Hunter wrote: "malik" == malik martin writes: malik>i'm having a simple problem i guess. but i still dont malik> know the answer. anyone see anything wrong with thi

Re: New to Python - block grouping (spaces)

2015-04-19 Thread Rustom Mody
On Sunday, April 19, 2015 at 11:38:45 PM UTC+5:30, Dan Sommers wrote: > What's to revamp? My IDE is UNIX. Precisely my point: source-file = text-file is centerstage of Unix philosophy If you want to start by questioning that, you must question not merely the language (python or whatever) but th

Re: do you guys help newbies??

2015-04-19 Thread josiah.l...@stu.nebo.edu
On Wednesday, November 27, 2002 at 4:01:02 AM UTC-7, John Hunter wrote: > > "malik" == malik martin writes: > > malik>i'm having a simple problem i guess. but i still dont > malik> know the answer. anyone see anything wrong with this code? > malik> i think it's the line in th

Re: New to Python - block grouping (spaces)

2015-04-19 Thread BartC
On 20/04/2015 00:59, Ben Finney wrote: BartC writes: I used actual languages Python and C in my example, I should have used A and B or something. If you had, then the topic drifts so far from being relevant to a Python programming forum that I'd ask you to stop. Perhaps that should have hap

Re: New to Python - block grouping (spaces)

2015-04-19 Thread Ben Finney
BartC writes: > I used actual languages Python and C in my example, I should have used > A and B or something. If you had, then the topic drifts so far from being relevant to a Python programming forum that I'd ask you to stop. Perhaps that should have happened much sooner. -- \ “If we

Re: New to Python - block grouping (spaces)

2015-04-19 Thread Ron Adam
On 04/19/2015 05:42 PM, BartC wrote: So I'm aware of some of the things that are involved. (BTW that project worked reasonably well, but I decided to go in a different direction: turning "J" from a mere syntax into an actual language of its own.) Something you might try with your new langua

Re: HELP! How to return the returned value from a threaded function

2015-04-19 Thread D. Xenakis
This worked like a charm. http://code.activestate.com/recipes/84317-easy-threading-with-futures/ -- https://mail.python.org/mailman/listinfo/python-list

Re: New to Python - block grouping (spaces)

2015-04-19 Thread BartC
On 19/04/2015 13:59, Ben Finney wrote: BartC writes: Why shouldn't A configure his editor to display a Python program in C-like syntax, and B configure their editor to use Python-like tabbed syntax? I don't recall anyone saying that *shouldn't* be done. Feel free to make, and maintain and su

Alternative to curve_fit() from scipy.optimize

2015-04-19 Thread ddidussa
Hello, I am trying to fit a curve of the form (ln(x+a))**b to a set of points. However, curve_fit() from scipy.optimize fails to find a consistent optimal solution (as I increase the number of data points, the coefficients found vary greatly). I suspect this is because of the algorithm that th

Re: New to Python - block grouping (spaces)

2015-04-19 Thread Marko Rauhamaa
Michael Torrie : > On 04/18/2015 01:00 AM, Marko Rauhamaa wrote: >> It would be possible to define a canonical AST storage format. Then, >> your editor could "incarnate" the AST in the syntax of your choosing. > > As was just mentioned in another part of the thread, what you're > describing is ess

Re: Best search algorithm to find condition within a range

2015-04-19 Thread Paul Rubin
Steven D'Aprano writes: > Have you tried Factor? I'm wondering if it is worth looking at, as a > more modern and less low-level version of Forth. Factor is basically Lisp with Forth-based syntax, from what I can tell. Tagged objects, garbage collection, etc. Forth is traditionally a self-hosted

Re: New to Python - block grouping (spaces)

2015-04-19 Thread Paul Rubin
Steven D'Aprano writes: > You might be interested in the Coffeescript model> > You'll notice that Coffeescript isn't a mere preprocessor or source code > transformation. I like Purescript (purescript.org) better than Coffeescript, but either way, I don't see Python as an attractive target fo

Re: Python and fortran Interface suggestion

2015-04-19 Thread Dave Angel
On 04/19/2015 11:56 AM, pauld11718 wrote: I shall provide with further details Its about Mathematical modelling of a system. Fortran does one part and python does the other part (which I am suppose to provide). For a time interval tn --> t_n+1, fortran code generates some values, for which

Re: New to Python - block grouping (spaces)

2015-04-19 Thread Chris Angelico
On Mon, Apr 20, 2015 at 4:07 AM, Dan Sommers wrote: > IMO, until git's successor tracks content-_not_-delimited-by-linefeeds, > languages will continue to work that way. Linefeeds are nothing to git - it tracks the entire content of the file. When you ask to see the diff between two versions of a

Re: Best search algorithm to find condition within a range

2015-04-19 Thread Dave Angel
On 04/19/2015 09:02 AM, Steven D'Aprano wrote: On Sun, 19 Apr 2015 04:08 am, Albert van der Horst wrote: Fire up a lowlevel interpreter like Forth. (e.g. gforth) Yay! I'm not the only one who uses or likes Forth! Have you tried Factor? I'm wondering if it is worth looking at, as a more moder

Re: New to Python - block grouping (spaces)

2015-04-19 Thread CHIN Dihedral
On Thursday, April 16, 2015 at 11:06:28 PM UTC+8, Mark Lawrence wrote: > On 16/04/2015 15:52, Blake McBride wrote: > > > So, Python may be a cute language for you to use as an individual, but it > > is unwieldy in a real development environment. > > > > Thanks for this, one of the funniest comme

Re: New to Python - block grouping (spaces)

2015-04-19 Thread Mel Wilson
On Mon, 20 Apr 2015 03:53:08 +1000, Steven D'Aprano wrote: > On Mon, 20 Apr 2015 02:03 am, Rustom Mody wrote: >> Well evidently some people did but fortunately their managers did not >> interfere. > > You are assuming they had managers. University life isn't exactly the > same as corporate cultu

Re: New to Python - block grouping (spaces)

2015-04-19 Thread Dan Sommers
On Sun, 19 Apr 2015 09:03:23 -0700, Rustom Mody wrote: > Now if Thomson and Ritchie (yeah thems the guys) could do it in 1970, > why cant we revamp this 45-year old archaic program=textfile system > today? Revamp? What's to revamp? C, C++, C#, Java, FORTRAN, Python, Perl, Ruby, POSIX shells, Ja

Re: New to Python - block grouping (spaces)

2015-04-19 Thread Steven D'Aprano
On Mon, 20 Apr 2015 02:03 am, Rustom Mody wrote: > On Sunday, April 19, 2015 at 8:45:27 PM UTC+5:30, Chris Angelico wrote: > > > >> I suspect you'll find the task fundamentally hard. > > How hard? > Lets see. > Two guys wanted to write an OS. > Seeing current languages not upto their standard

Re: New to Python - block grouping (spaces)

2015-04-19 Thread Steven D'Aprano
On Sun, 19 Apr 2015 09:38 pm, BartC wrote: > (I think much of the problem that most languages are intimately > associated with their specific syntax, so that people can't see past it > to what the code is actually saying. a=b, a:=b, b=>a, (setf a b), > whatever the syntax is, who cares? We just wa

Re: New to Python - block grouping (spaces)

2015-04-19 Thread Mel Wilson
On Sun, 19 Apr 2015 09:03:23 -0700, Rustom Mody wrote: > Now if Thomson and Ritchie (yeah thems the guys) could do it in 1970, > why cant we revamp this 45-year old archaic program=textfile system > today? Dunno. Why not? There's half of you right there. -- https://mail.python.org/mailman/lis

Re: New to Python - block grouping (spaces)

2015-04-19 Thread Michael Torrie
On 04/18/2015 01:00 AM, Marko Rauhamaa wrote: > Ben Finney : > >> If you only write programs that will only ever be read by you and >> no-one else, feel free to maintain a fork of Python (or any other >> language) that suits your personal preferences. > > It would be possible to define a canonica

Re: New to Python - block grouping (spaces)

2015-04-19 Thread Rustom Mody
On Sunday, April 19, 2015 at 8:45:27 PM UTC+5:30, Chris Angelico wrote: > I suspect you'll find the task fundamentally hard. How hard? Lets see. Two guys wanted to write an OS. Seeing current languages not upto their standard they first made themselves a suitable language. Would you call their

Re: Python and fortran Interface suggestion

2015-04-19 Thread pauld11718
I shall provide with further details Its about Mathematical modelling of a system. Fortran does one part and python does the other part (which I am suppose to provide). For a time interval tn --> t_n+1, fortran code generates some values, for which my python code accepts it as an input. It i

Re: Python and fortran Interface suggestion

2015-04-19 Thread Chris Angelico
On Mon, Apr 20, 2015 at 12:48 AM, pauld11718 wrote: > I am developing a code under Ubuntu(64bit) with python using various > libraries. Once done, I need to generate an executable which shall be > interfaced with fortran program on account of further collaboration. The > python executable shall

Re: Best search algorithm to find condition within a range

2015-04-19 Thread Gene Heskett
On Sunday 19 April 2015 10:56:49 Marko Rauhamaa wrote: > Steven D'Aprano : > > Yay! I'm not the only one who uses or likes Forth! > > Out of interest, is Forth different from PostScript? I have done some > small-time programming in PostScript but nothing in Forth. > > > Marko No relationship detec

Re: New to Python - block grouping (spaces)

2015-04-19 Thread Chris Angelico
On Sun, Apr 19, 2015 at 9:38 PM, BartC wrote: > Suppose there were just two syntaxes: C-like and Python-like (we'll put > aside for a minute the question of what format is used to store Python > source code). > > Why shouldn't A configure his editor to display a Python program in C-like > syntax,

Re: Best search algorithm to find condition within a range

2015-04-19 Thread Marko Rauhamaa
Steven D'Aprano : > Yay! I'm not the only one who uses or likes Forth! Out of interest, is Forth different from PostScript? I have done some small-time programming in PostScript but nothing in Forth. Marko -- https://mail.python.org/mailman/listinfo/python-list

Python and fortran Interface suggestion

2015-04-19 Thread pauld11718
I am developing a code under Ubuntu(64bit) with python using various libraries. Once done, I need to generate an executable which shall be interfaced with fortran program on account of further collaboration. The python executable shall be used with windows(32bit). So, I guess everytime my pytho

Re: New to Python - block grouping (spaces)

2015-04-19 Thread Rustom Mody
On Sunday, April 19, 2015 at 5:15:07 PM UTC+5:30, BartC wrote: > On 18/04/2015 03:22, Rustom Mody wrote: > > On Saturday, April 18, 2015 at 6:49:30 AM UTC+5:30, Dan Sommers wrote: > >> On Fri, 17 Apr 2015 18:05:52 +0100, BartC wrote: > >> > >>> (Actually *I* would quite like to know why languages d

Re: New to Python - block grouping (spaces)

2015-04-19 Thread Mark Lawrence
On 19/04/2015 13:59, Ben Finney wrote: BartC writes: Why shouldn't A configure his editor to display a Python program in C-like syntax, and B configure their editor to use Python-like tabbed syntax? I don't recall anyone saying that *shouldn't* be done. Feel free to make, and maintain and su

Re: New to Python - block grouping (spaces)

2015-04-19 Thread Steven D'Aprano
On Sun, 19 Apr 2015 09:38 pm, BartC wrote: > Suppose there were just two syntaxes: C-like and Python-like (we'll put > aside for a minute the question of what format is used to store Python > source code). > > Why shouldn't A configure his editor to display a Python program in > C-like syntax, an

Re: New to Python - block grouping (spaces)

2015-04-19 Thread Steven D'Aprano
On Sun, 19 Apr 2015 09:44 pm, BartC wrote: > When I sometimes want to code in Python, why can't I used my usual syntax? When I go to China, why doesn't everyone speak English for my convenience? I'll tell you what. When you convince the makers of C compilers to support Python syntax as an altern

Re: New to Python - block grouping (spaces)

2015-04-19 Thread Dave Angel
On 04/19/2015 07:38 AM, BartC wrote: Perhaps you don't understand what I'm getting at. Suppose there were just two syntaxes: C-like and Python-like (we'll put aside for a minute the question of what format is used to store Python source code). Why shouldn't A configure his editor to displa

Re: Best search algorithm to find condition within a range

2015-04-19 Thread Steven D'Aprano
On Sun, 19 Apr 2015 04:08 am, Albert van der Horst wrote: > Fire up a lowlevel interpreter like Forth. (e.g. gforth) Yay! I'm not the only one who uses or likes Forth! Have you tried Factor? I'm wondering if it is worth looking at, as a more modern and less low-level version of Forth. -- Stev

Re: New to Python - block grouping (spaces)

2015-04-19 Thread Ben Finney
BartC writes: > Why shouldn't A configure his editor to display a Python program in > C-like syntax, and B configure their editor to use Python-like tabbed > syntax? I don't recall anyone saying that *shouldn't* be done. Feel free to make, and maintain and support and propagate and keep pace wit

Re: New to Python - block grouping (spaces)

2015-04-19 Thread BartC
On 18/04/2015 03:22, Rustom Mody wrote: On Saturday, April 18, 2015 at 6:49:30 AM UTC+5:30, Dan Sommers wrote: On Fri, 17 Apr 2015 18:05:52 +0100, BartC wrote: (Actually *I* would quite like to know why languages don't have switchable syntax anyway to allow for people's personal preferences.)

Re: New to Python - block grouping (spaces)

2015-04-19 Thread BartC
On 18/04/2015 03:22, Ben Finney wrote: BartC writes: (Actually *I* would quite like to know why languages don't have switchable syntax anyway to allow for people's personal preferences.) Which people's personal preferences? Are these the same people who have such passionate disagreement abou

Re: sorting list by multiple criteria and grouping alphabetically in python

2015-04-19 Thread Chris Angelico
On Sat, Apr 18, 2015 at 5:56 PM, Ahamed Farook wrote: > sorted(lsNearCities, key=operator.itemgetter(1,0)) This doesn't sort the list, it constructs a new one - and then promptly discards it. What you want is the .sort() method on the list object. As your code is incomplete, I can't say if there