[OT] git and hg in prompt (was: My first ever Python program, comments welcome)

2012-07-24 Thread Tim Delaney
On 24 July 2012 21:34, Lipska the Kat wrote: > On 24/07/12 06:13, rusi wrote: > >> On Jul 22, 10:23 pm, Lipska the Kat wrote: >> >> Heh heh, Nothing to do with Eclipse, just another thing to get my head >>> around. For work and Java IMHO you can't beat eclipse... >>> at the moment I'm getting m

Re: My first ever Python program, comments welcome

2012-07-24 Thread Lipska the Kat
On 24/07/12 06:13, rusi wrote: On Jul 22, 10:23 pm, Lipska the Kat wrote: Heh heh, Nothing to do with Eclipse, just another thing to get my head around. For work and Java IMHO you can't beat eclipse... at the moment I'm getting my head around git, Bumped into this yesterday. Seems like a goo

Re: My first ever Python program, comments welcome

2012-07-23 Thread rusi
On Jul 22, 10:23 pm, Lipska the Kat wrote: > Heh heh, Nothing to do with Eclipse, just another thing to get my head > around. For work and Java IMHO you can't beat eclipse... > at the moment I'm getting my head around git, Bumped into this yesterday. Seems like a good aid to git-comprehension ht

Re: My first ever Python program, comments welcome

2012-07-23 Thread Ivan@work
On 21.07.2012 21:08, Lipska the Kat wrote: Greetings Pythoners A short while back I posted a message that described a task I had set myself. I wanted to implement the following bash shell script in Python Here's the script sort -nr $1 | head -${2:-10} this script takes a filename and an optio

Re: My first ever Python program, comments welcome

2012-07-22 Thread Lipska the Kat
On 22/07/12 17:18, rusi wrote: On Jul 22, 2:20 pm, Lipska the Kat wrote: Well I have to say that I've used Eclipse with the myEclipse plugin for a number of years now and although it has it's moments it has earned me LOADS of MONEY so I can't really criticise it. Ive probably tried to use ec

Re: My first ever Python program, comments welcome

2012-07-22 Thread rusi
On Jul 22, 2:20 pm, Lipska the Kat wrote: > Well I have to say that I've used Eclipse with the myEclipse plugin for > a number of years now and although it has it's moments it has earned me > LOADS of MONEY so I can't really criticise it. Ive probably tried to use eclipse about 4 times in the la

Re: My first ever Python program, comments welcome

2012-07-22 Thread Lipska the Kat
On 22/07/12 11:17, Chris Angelico wrote: On Sun, Jul 22, 2012 at 6:49 PM, Andrew Berg wrote: On 7/22/2012 3:37 AM, Lipska the Kat wrote: Many in the Linux world seem to use git. snip Use source control now; you'll reap the benefits later! from sudo apt-get install git to git add *.py wa

Re: My first ever Python program, comments welcome

2012-07-22 Thread David
On 22/07/2012, Lipska the Kat wrote: > On 21/07/12 21:10, Dave Angel wrote: >> >> A totally off-the-wall query. Are you using a source control system, >> such as git ? It can make you much braver about refactoring a working >> program. > > Thanks for your comments, I've taken them on board, > I'

Re: My first ever Python program, comments welcome

2012-07-22 Thread Chris Angelico
On Sun, Jul 22, 2012 at 6:49 PM, Andrew Berg wrote: > On 7/22/2012 3:37 AM, Lipska the Kat wrote: >> Many in >> the Linux world seem to use git. Seeing as I've been using Linux at home >> since the early days of slackware I suppose I'd better look into it. > There are Mercurial (aka Hg) and Bazaar

Re: My first ever Python program, comments welcome

2012-07-22 Thread Lipska the Kat
On 22/07/12 03:55, rusi wrote: On Jul 22, 1:10 am, Dave Angel wrote: A totally off-the-wall query. Are you using a source control system, such as git ? It can make you much braver about refactoring a working program. Question in a similar vein: What development environment do you use? My i

Re: My first ever Python program, comments welcome

2012-07-22 Thread Andrew Berg
On 7/22/2012 3:37 AM, Lipska the Kat wrote: > Many in > the Linux world seem to use git. Seeing as I've been using Linux at home > since the early days of slackware I suppose I'd better look into it. There are Mercurial (aka Hg) and Bazaar as well for DVCS. AFAIK, git, Mercurial, and Bazaar are a

Re: My first ever Python program, comments welcome

2012-07-22 Thread Lipska the Kat
On 21/07/12 21:10, Dave Angel wrote: On 07/21/2012 03:08 PM, Lipska the Kat wrote: Greetings Pythoners A short while back I posted a message that described a task I had set myself. I wanted to implement the following bash shell script in Python snip A totally off-the-wall query. Are y

Re: My first ever Python program, comments welcome

2012-07-22 Thread Mark Lawrence
On 22/07/2012 03:55, rusi wrote: On Jul 22, 1:10 am, Dave Angel wrote: A totally off-the-wall query. Are you using a source control system, such as git ? It can make you much braver about refactoring a working program. Question in a similar vein: What development environment do you use? My

Re: My first ever Python program, comments welcome

2012-07-22 Thread Peter Otten
Lipska the Kat wrote: > Greetings Pythoners > > A short while back I posted a message that described a task I had set > myself. I wanted to implement the following bash shell script in Python > > Here's the script > > sort -nr $1 | head -${2:-10} > > this script takes a filename and an optiona

Re: My first ever Python program, comments welcome

2012-07-21 Thread rusi
On Jul 22, 1:10 am, Dave Angel wrote: > A totally off-the-wall query.  Are you using a source control system, > such as git ?  It can make you much braver about refactoring a working > program. Question in a similar vein: What development environment do you use? My impression is that the majorit

Re: My first ever Python program, comments welcome

2012-07-21 Thread Dave Angel
On 07/21/2012 09:56 PM, MRAB wrote: > On 22/07/2012 01:32, Steven D'Aprano wrote: >> On Sat, 21 Jul 2012 20:40:46 +0100, MRAB wrote: >> >>> On 21/07/2012 20:08, Lipska the Kat wrote: l=sorted(l, key=itemgetter(0)) >>> >>> Short is: >>> >>> l.sort(key=itemgetter(0)) >> >> Shorter, and

Re: My first ever Python program, comments welcome

2012-07-21 Thread Chris Angelico
On Sun, Jul 22, 2012 at 11:56 AM, MRAB wrote: > Since the result is bound to the original name, the > result is the same. Yes, assuming there are no other refs. >>> a=[3,2,1] >>> b=a >>> a=sorted(a) >>> a [1, 2, 3] >>> b [3, 2, 1] ChrisA -- http://mail.python.org/mailman/listinfo/python-list

Re: My first ever Python program, comments welcome

2012-07-21 Thread MRAB
On 22/07/2012 01:32, Steven D'Aprano wrote: On Sat, 21 Jul 2012 20:40:46 +0100, MRAB wrote: On 21/07/2012 20:08, Lipska the Kat wrote: l=sorted(l, key=itemgetter(0)) Short is: l.sort(key=itemgetter(0)) Shorter, and the semantics are subtly different. The sorted function retu

Re: My first ever Python program, comments welcome

2012-07-21 Thread Steven D'Aprano
On Sat, 21 Jul 2012 16:10:51 -0400, Dave Angel wrote: >> with fileinput.input(files=(filename)) as f: > > fileinput is much more general than you want for processing a single > file. That may be deliberate, if you're picturing somebody using > wildcards on their input. But if so, you should pro

Re: My first ever Python program, comments welcome

2012-07-21 Thread Steven D'Aprano
On Sat, 21 Jul 2012 20:40:46 +0100, MRAB wrote: > On 21/07/2012 20:08, Lipska the Kat wrote: >> l=sorted(l, key=itemgetter(0)) > > Short is: > > l.sort(key=itemgetter(0)) Shorter, and the semantics are subtly different. The sorted function returns a copy of the input list. The list.s

Re: My first ever Python program, comments welcome

2012-07-21 Thread Dave Angel
On 07/21/2012 03:08 PM, Lipska the Kat wrote: > Greetings Pythoners > > A short while back I posted a message that described a task I had set > myself. I wanted to implement the following bash shell script in Python > You already have comments from Ian and MRAB, and I'll try to point out only thin

Re: My first ever Python program, comments welcome

2012-07-21 Thread MRAB
On 21/07/2012 20:08, Lipska the Kat wrote: Greetings Pythoners A short while back I posted a message that described a task I had set myself. I wanted to implement the following bash shell script in Python Here's the script sort -nr $1 | head -${2:-10} this script takes a filename and an optio

Re: My first ever Python program, comments welcome

2012-07-21 Thread Ian Foote
On 21/07/12 20:08, Lipska the Kat wrote: Greetings Pythoners A short while back I posted a message that described a task I had set myself. I wanted to implement the following bash shell script in Python Here's the script sort -nr $1 | head -${2:-10} this script takes a filename and an optio

My first ever Python program, comments welcome

2012-07-21 Thread Lipska the Kat
Greetings Pythoners A short while back I posted a message that described a task I had set myself. I wanted to implement the following bash shell script in Python Here's the script sort -nr $1 | head -${2:-10} this script takes a filename and an optional number of lines to display and sorts t