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 12Jun2014 00:38, Alan Gauld alan.ga...@btinternet.com 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

Re: [Tutor] code review

2014-06-11 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

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-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

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 time

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 conversations - it's

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

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 =

[Tutor] code review

2014-06-10 Thread Adam Gold
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 been able to code more efficiently/effectively. I don't think it

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 been

Re: [Tutor] Code Review?

2012-08-07 Thread Tino Dai
On Mon, Aug 6, 2012 at 6:27 PM, Brian Carpio bcar...@thetek.net 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.

[Tutor] Code Review?

2012-08-06 Thread Brian Carpio
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 looking for someone to take a look at

Re: [Tutor] Code Review?

2012-08-06 Thread Ramchandra Apte
Another practice is make __license__ = GPL license... and __author__ = Brian Carpio x...@xxx.com I do so. On 6 August 2012 19:08, Ramchandra Apte maniandra...@gmail.com wrote: In scripts/add_node.py GPL Licene should be GPL License On 6 August 2012 18:59, Brian Carpio bcar...@thetek.net

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 bcar...@thetek.net 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;

Re: [Tutor] Code Review?

2012-08-06 Thread Tino Dai
On Mon, Aug 6, 2012 at 9:39 AM, Ramchandra Apte maniandra...@gmail.comwrote: Another practice is make __license__ = GPL license... and __author__ = Brian Carpio x...@xxx.com I do so. On 6 August 2012 19:08, Ramchandra Apte maniandra...@gmail.com wrote: In scripts/add_node.py GPL Licene

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 bcar...@thetek.net 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

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 looking for

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 python I've

Re: [Tutor] Code review, plase

2010-09-08 Thread Alex
On Wed, Sep 8, 2010 at 12:20 AM, Steven D'Aprano st...@pearwood.info 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

[Tutor] Code review, plase

2010-09-07 Thread Alex
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 Thanks in advance. Alex

Re: [Tutor] Code review, plase

2010-09-07 Thread Wayne Werner
On Tue, Sep 7, 2010 at 3:39 PM, Alex metallourla...@gmail.com 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:

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 Let's

[Tutor] code review request

2006-01-04 Thread Will Harris
Hoping to get some of you guru types to look over the start of a tool I am working on in python. A working version of the script is at https://mikaru.homeunix.org/py-bin/memberlist.py The site only allows https because I got sick of all the hacked windoze boxes trying to execute crap that I

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. The

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.split().

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 does

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 letters is

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)

[Tutor] code review please

2005-12-27 Thread Eakin, W
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. The following program takes a text file, reads through it, and

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

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 = ''

[Tutor] Code review

2005-01-25 Thread Barnaby Scott
If anyone has the time to look through an entire script, I would would be very grateful for any comments, tips or suggestions on a wiki-engine script I am working on. http://www.waywood.co.uk/cgi-bin/monkeywiki.py (this will download rather than execute) It does work, but I have not been using