Re: [Tutor] code review

2014-06-13 Thread Adam Gold
On 12/06/14 00:38, Alan Gauld wrote: > > HTH Thanks Alan and Lukáš for your very helpful comments. I will attempt to revise the script in light of them and will revert if I hit any brick walls :) ___ Tutor maillist - Tutor@python.org To unsubscribe

Re: [Tutor] code review

2014-06-12 Thread Cameron Simpson
On 13Jun2014 12:28, Cameron Simpson wrote: snap_path = os.path.join(VXGEN_DIR, snapName) backupList.append(snap_name) Sorry, "snap_path" in both lines:-( Cheers, Cameron Simpson ___ Tutor maillist - Tutor@python.org To unsubscribe or change sub

Re: [Tutor] code review

2014-06-12 Thread Cameron Simpson
On 12Jun2014 00:38, Alan Gauld wrote: On 11/06/14 11:43, Adam Gold wrote: # create snapshot names like the following: 2014-06-10T01-00-01.vm1.img.bz2 for i in vgxenList: DATE = datetime.datetime.now().strftime("%Y-%m-%d" + "T" + "%H-%M-%S") Why use addition? You could just insett the lite

Re: [Tutor] code review

2014-06-11 Thread Alan Gauld
On 11/06/14 11:43, Adam Gold wrote: # create snapshot names like the following: 2014-06-10T01-00-01.vm1.img.bz2 for i in vgxenList: DATE = datetime.datetime.now().strftime("%Y-%m-%d" + "T" + "%H-%M-%S") Why use addition? You could just insett the literal T... DATE = datetime.datetime.now

Re: [Tutor] code review

2014-06-11 Thread Lukáš Němec
Ok, not so bad, hoewer there are some parts of the code that could be done a bit cleaner. I'll write them below in the response. Thanks for the reply Steven. It's no more than 100 lines at a guess In that case just copy and paste it into a message and send it to the group. Anyone with time av

Re: [Tutor] code review

2014-06-11 Thread Adam Gold
>>> Thanks for the reply Steven. It's no more than 100 lines at a >>> guess > >> In that case just copy and paste it into a message and send it to >> the group. Anyone with time available can then take a peek. > > One way noobs anywhere can learn is by listening in to other people's > conversati

Re: [Tutor] code review

2014-06-11 Thread Bob Williams
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 11/06/14 08:11, Alan Gauld wrote: > On 11/06/14 00:30, Adam Gold wrote: > >> Thanks for the reply Steven. It's no more than 100 lines at a >> guess > > In that case just copy and paste it into a message and send it to > the group. Anyone with tim

Re: [Tutor] code review

2014-06-11 Thread Alan Gauld
On 11/06/14 00:30, Adam Gold wrote: Thanks for the reply Steven. It's no more than 100 lines at a guess In that case just copy and paste it into a message and send it to the group. Anyone with time available can then take a peek. hth -- Alan G Author of the Learn to Program web site http:

Re: [Tutor] code review

2014-06-11 Thread Adam Gold
On 11/06/14 00:04, Steven D'Aprano wrote: > On Tue, Jun 10, 2014 at 04:51:20PM +0100, Adam Gold wrote: >> Hi there. I've been writing a script that is now finished and working >> (thanks, in part, to some helpful input from this board). What I'd >> really like to do now is go through it with an '

Re: [Tutor] code review

2014-06-10 Thread Lukas Nemec
Post it somewhere on github and I'll try to take a look at it. Lukas On 06/10/2014 05:51 PM, Adam Gold wrote: Hi there. I've been writing a script that is now finished and working (thanks, in part, to some helpful input from this board). What I'd really like to do now is go through it with an

Re: [Tutor] code review

2014-06-10 Thread Steven D'Aprano
On Tue, Jun 10, 2014 at 04:51:20PM +0100, Adam Gold wrote: > Hi there. I've been writing a script that is now finished and working > (thanks, in part, to some helpful input from this board). What I'd > really like to do now is go through it with an 'expert' who can point > out ways I may have bee

Re: [Tutor] Code Review?

2012-08-07 Thread Tino Dai
On Mon, Aug 6, 2012 at 6:27 PM, Brian Carpio wrote: > Thanks to everyone who has replied! This is some good information for me > to go learn with!. > > I greatly appreciate it. > > When you refactor your code, let us know. I, for one, would like to see it.

Re: [Tutor] Code Review?

2012-08-06 Thread Brian Carpio
Thanks to everyone who has replied! This is some good information for me to go learn with!. I greatly appreciate it. Brian On Mon, Aug 6, 2012 at 9:21 AM, Peter Otten <__pete...@web.de> wrote: > Brian Carpio wrote: > > > Hi, > > > > Hopefully I am allowed to ask this here. I am pretty new to py

Re: [Tutor] Code Review?

2012-08-06 Thread Peter Otten
Brian Carpio wrote: > Hi, > > Hopefully I am allowed to ask this here. I am pretty new to python I've > only been writing code for about 6 months now strictly for system > administration purposes; however I have now decided to write something > "real" that others might benefit from but I am looki

Re: [Tutor] Code Review?

2012-08-06 Thread Mark Lawrence
On 06/08/2012 14:38, Ramchandra Apte wrote: [top posting fixed] On 6 August 2012 18:59, Brian Carpio wrote: Hi, Hopefully I am allowed to ask this here. I am pretty new to python I've only been writing code for about 6 months now strictly for system administration purposes; however I have n

Re: [Tutor] Code Review?

2012-08-06 Thread Tino Dai
On Mon, Aug 6, 2012 at 9:39 AM, Ramchandra Apte wrote: > Another practice is make __license__ = "GPL license..." > and __author__ = "Brian Carpio " > I do so. > > > On 6 August 2012 19:08, Ramchandra Apte wrote: > >> In scripts/add_node.py GPL Licene should be GPL License >> >> >> Brian, I

Re: [Tutor] Code Review?

2012-08-06 Thread Ramchandra Apte
In scripts/add_node.py GPL Licene should be GPL License On 6 August 2012 18:59, Brian Carpio wrote: > Hi, > > Hopefully I am allowed to ask this here. I am pretty new to python I've > only been writing code for about 6 months now strictly for system > administration purposes; however I have now

Re: [Tutor] Code Review?

2012-08-06 Thread Ramchandra Apte
Another practice is make __license__ = "GPL license..." and __author__ = "Brian Carpio " I do so. On 6 August 2012 19:08, Ramchandra Apte wrote: > In scripts/add_node.py GPL Licene should be GPL License > > On 6 August 2012 18:59, Brian Carpio wrote: > >> Hi, >> >> Hopefully I am allowed to ask

Re: [Tutor] Code review, plase

2010-09-08 Thread Alex
On Wed, Sep 8, 2010 at 12:20 AM, Steven D'Aprano wrote: > On Wed, 8 Sep 2010 06:39:27 am Alex wrote: >> Hi all. >> >> Could someone review my code? It's the first time I develop a >> reusable module and I would like to have some feedback. >> If you think it's good enough I will package it for pypi

Re: [Tutor] Code review, plase

2010-09-07 Thread Steven D'Aprano
On Wed, 8 Sep 2010 06:39:27 am Alex wrote: > Hi all. > > Could someone review my code? It's the first time I develop a > reusable module and I would like to have some feedback. > If you think it's good enough I will package it for pypi. > > I put the code on pastebin: http://pastebin.com/Tz367gAM

Re: [Tutor] Code review, plase

2010-09-07 Thread Wayne Werner
On Tue, Sep 7, 2010 at 3:39 PM, Alex wrote: > Hi all. > > Could someone review my code? It's the first time I develop a reusable > module and I would like to have some feedback. > If you think it's good enough I will package it for pypi. > > I put the code on pastebin: http://pastebin.com/Tz367gA

Re: [Tutor] code review please

2005-12-28 Thread Brian van den Broek
Kent Johnson said unto the world upon 28/12/05 07:06 AM: > Brian van den Broek wrote: > >>def punctuation_split(sequence): >> '''returns list of character sequences separating punctuation >>characters''' >> for mark in punctuation: >> sequence = sequence.replace(mark, ' %s ' %mark

Re: [Tutor] code review please

2005-12-28 Thread Kent Johnson
Kent Johnson wrote: > BTW thinking of writing this as a loop brings to mind some problems - > what will your program do with 'words' such as 555-1212 or "Ha!" ? Hmm, on reflection I don't thing "Ha!" will be a problem, but a 'word' with no letters will cause an IndexError. Your test for 4 lette

Re: [Tutor] code review please

2005-12-28 Thread Kent Johnson
Danny Yoo wrote: > Similarly, the try/except for IndexError seems too pervasive: rather than > wrap it around the whole program, we may want to limit its extent to just > around the sys.argv access. Otherwise, any other IndexError has the > potential of being misattributed. Much of the program do

Re: [Tutor] code review please

2005-12-28 Thread Kent Johnson
Brian van den Broek wrote: > def punctuation_split(sequence): > '''returns list of character sequences separating punctuation > characters''' > for mark in punctuation: > sequence = sequence.replace(mark, ' %s ' %mark) > return sequence.split(' ') You should look at re.spl

Re: [Tutor] code review please

2005-12-28 Thread Brian van den Broek
Eakin, W said unto the world upon 27/12/05 09:59 AM: > Hello, > Although I've been coding in PHP and ASP and JavaScript for a couple of > years now, I'm relatively new to Python. For learning exercises, I'm writing > small Python programs that do limited things, but hopefully do them well. > >

Re: [Tutor] code review please

2005-12-27 Thread Kent Johnson
Eakin, W wrote: > The code follows, so any comments and/or suggestions as to what I did > right or wrong, or what could be done better will be appreciated. > def fileScramble(fileName): > newFile = file('scrambled.txt', 'w') > newRow = '' > for line in fileName: > newRow = ''

Re: [Tutor] code review please

2005-12-27 Thread Danny Yoo
Hi William, Here are some constructive comments on the program; if you have questions on any of it, please feel free to ask. > def fileScramble(fileName): We may want to rename "fileName" to something else, as it isn't being treated as a filename, but more like a file-like object. Good names