Serdar Tumgoren wrote:
Hi Kent and Lie,
First, thanks to you both for the help. I reworked the tests and then
the main code according to your suggestions (I really was muddling
these TDD concepts!).
The reworked code and tests are below. In the tests, I hard-coded the
source data and the expect
Hi,
I wan't to buy some books about python 3. Do you have any recommendations?
I started with no previous programming experience, and I've finished a few
tutorials and I guess I can be considered a beginner.
My problem, though, is I still find it difficult to write meaningful code or
use the bu
On Tue, Dec 1, 2009 at 11:48 AM, Faisal Moledina
wrote:
> Eike Welk wrote:
>> Just in case you don't know it, maybe Pytables is the right solution
>> for you. It is a disk storage library specially for scientific
>> applications:
>> http://www.pytables.org/moin
>
> Wow, that looks pretty good. I w
On Tue, Dec 8, 2009 at 10:11 PM, Serdar Tumgoren wrote:
> Hi Kent and Lie,
>
> First, thanks to you both for the help. I reworked the tests and then
> the main code according to your suggestions (I really was muddling
> these TDD concepts!).
>
> The reworked code and tests are below. In the tests,
Thank you to all who replied. That does help me get a better
idea of all this. I think if I apply a number of the thoughts
expressed I can come to a good, readable re-do of these
longer functions.
Che
_
Hi Kent and Lie,
First, thanks to you both for the help. I reworked the tests and then
the main code according to your suggestions (I really was muddling
these TDD concepts!).
The reworked code and tests are below. In the tests, I hard-coded the
source data and the expected results; in the main p
On 12/9/2009 10:43 AM, Kent Johnson wrote:
So my questions -- Am I misunderstanding how to properly write unit
tests for this case? Or perhaps I've structured my program
incorrectly, and that's what this duplication reveals? I suspected,
for instance, that perhaps I should group these methods
(co
"Serdar Tumgoren" wrote
http://www.freenetpages.co.uk/hp/alan.gauld/
Note the new URL in my sig. Freenet are due to close this site "soon".
Its been locked for over a year.
--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/
On 12/9/2009 3:18 AM, Rich Lovely wrote:
2009/12/8 spir:
This, of course is a rather dirty, implementation (and probably
version) specific hack, but I can /calculate/ the sequence, using just
one line:
print " ".join(str(i) for i in [x if x<2 else
(locals()['_[1]'][-1]+locals()['_[1]'][-2]) f
On Tue, 2009-12-08 at 14:55 -0800, Roy Hinkelman wrote:
> shutil.copy2(_files_to_mod + "\\" + fname, _files_to_mod + "\\" +
> new_name)
You can make os.path.join sort out the directory seprator for you. It
will add a / under linux and \ under windows.
>>> os.path.join('Testing dir','oldname dir',
On Tue, Dec 8, 2009 at 6:02 PM, Serdar Tumgoren wrote:
> As part of my program, I'm planning to create objects that perform
> some initial data clean-up and then parse and database the cleaned
> data. Currently I'm expecting to have a FileCleaner and Parser
> classes. Using the TDD approach, I've
On 12/8/2009 10:43 PM, Alan Gauld wrote:
While you should not refactor just for the sake of keeping
line-counts, perhaps you should try the small editor approach. Keep
your editor unmaximized, for around 20 lines, around half a screen.
Hmm, I spent the first 10 years of my programming life u
Hi everyone,
I'm trying to apply some lessons from the recent list discussions on
unit testing and Test-Driven Development, but I seem to have hit a
sticking point.
As part of my program, I'm planning to create objects that perform
some initial data clean-up and then parse and database the cleaned
I got it.
Switched to shutil and made to paths complete paths. The added benefit is
that it didn't trash the original file.
shutil.copy2(_files_to_mod + "\\" + fname, _files_to_mod + "\\" + new_name)
Thanks.
-- Forwarded message --
From: Roy Hinkelman
Date: Tue, Dec 8, 2009 at
You should probably read some of the links sent to you earlier but here is
a stab at an explanation.
Richard Hultgren wrote on 12/08/2009 10:36:08 AM:
> - Forwarded Message
> From: Richard Hultgren
> To: tutor@python.org
> Sent: Mon, December 7, 2009 2:53:40 PM
> Subject: loops
> I'm
spir wrote:
Roy Hinkelman dixit:
I can't find anything on this error I am getting when renaming some files.
I'm pulling info from a csv file and parsing it to build new file names.
Any pointers appreciated
Roy
My code:
# RENAME FILES using META file - new name = [place]_[state]_[sku].tif
Why don't you simply print out fname? This should point you to the error.
Denis
I did here:
> if fname == old_name:
> print fname # test
and it looks correct.
On an WinXP, should I use shutil instead?
Roy
___
Tutor maillist - T
Roy Hinkelman dixit:
> I can't find anything on this error I am getting when renaming some files.
> I'm pulling info from a csv file and parsing it to build new file names.
>
> Any pointers appreciated
>
> Roy
>
> My code:
> # RENAME FILES using META file - new name = [place]_[state]_[sku].tif
I can't find anything on this error I am getting when renaming some files.
I'm pulling info from a csv file and parsing it to build new file names.
Any pointers appreciated
Roy
My code:
# RENAME FILES using META file - new name = [place]_[state]_[sku].tif
import re, os, csv
# DEFINE
_meta_file
> - Forwarded Message
> From: Richard Hultgren
> To: tutor@python.org
> Sent: Mon, December 7, 2009 2:53:40 PM
> Subject: loops
> I'm quite new but determined. Can you explain to me, step by step, what is
> going on in the computer in this loop. I hope I am not being too dumb!
>
Hmm...
- Forwarded Message
From: Richard Hultgren
To: tutor@python.org
Sent: Mon, December 7, 2009 2:53:40 PM
Subject: loops
I'm quite new but determined. Can you explain to me, step by step, what is
going on in the computer in this loop. I hope I am not being too dumb!
a = 0
b = 1
coun
2009/12/8 spir :
> Lie Ryan dixit:
>
>> On 12/8/2009 9:39 PM, Dave Angel wrote:
>> > Richard Hultgren wrote:
>> >> a = 0
>> >> b = 1
>> >> count = 0
>> >> max_count = 20
>> >> while count < max_count:
>> >> count = count + 1
>> >> # we need to keep track of a since we change it
>> >> old_a = a # e
On Tue, Dec 8, 2009 at 4:17 AM, spir wrote:
> Luke Paireepinart dixit:
>
> > I'd say my personal hard-limit for functions before I start refactoring
> is
> > probably around 150-200 lines. But it's rare that functions get that
> long
> > anyway.
>
> !
>
> Aside questions of personal style & tas
On Mo, 2009-12-07 at 23:10 -0500, Marc wrote:
> While I agree with the cookie (as long as it has a short expiration),
> another way to do this is by using expiring tokenization (credentials+ some
> unique data for the transaction) in the URL header (see section 14.8 at
> http://www.w3.org/Protocol
"Lie Ryan" wrote
editor screen (or sheet of printout) - when I started that meant
25-60 lines was the range, now you can go up to 60-100 lines if needs
be...
I disagree. I keep my text editor not maximized so I can have multiple
editors open (or multiple splits when using (g)vim); a 100-line
Lie Ryan dixit:
> On 12/8/2009 9:39 PM, Dave Angel wrote:
> > Richard Hultgren wrote:
> >> a = 0
> >> b = 1
> >> count = 0
> >> max_count = 20
> >> while count < max_count:
> >> count = count + 1
> >> # we need to keep track of a since we change it
> >> old_a = a # especially here
> >> old_b = b
This is a new evidence that coding efficiency is more a question of coder
quality than anything else...
Don't know about "new", The book Peopleware was highlighting that fact 20
years ago!
It also showed the type of environment that maximised the productivity of
good
programmers - sadly, most
On 12/8/2009 9:39 PM, Dave Angel wrote:
Richard Hultgren wrote:
a = 0
b = 1
count = 0
max_count = 20
while count < max_count:
count = count + 1
# we need to keep track of a since we change it
old_a = a # especially here
old_b = b
a = old_b
b = old_a + old_b
# Notice that the , at the end of a pr
Richard Hultgren wrote:
a = 0
b = 1
count = 0
max_count = 20
while count < max_count:
count = count + 1
# we need to keep track of a since we change it
old_a = a# especially here
old_b = b
a = old_b
b = old_a + old_b
# Notice that the , at the end of a
On 12/8/2009 8:27 PM, Alan Gauld wrote:
Remember the old adage that a function should ideally fit on a single
editor screen (or sheet of printout) - when I started that meant
25-60 lines was the range, now you can go up to 60-100 lines if needs be...
I disagree. I keep my text editor not maxim
Luke Paireepinart dixit:
> I'd say my personal hard-limit for functions before I start refactoring is
> probably around 150-200 lines. But it's rare that functions get that long
> anyway.
!
Aside questions of personal style & taste, _I_ could not hold such long funcs.
Far too much to manage f
"Che M" wrote
I have some functions that seem kind of long to me. One of them, with
I realize I can and should refactor parts that are used in other places
in the code, but I don't there are that many in some of these. Is
there a better way to think about organizing this?
The length as s
32 matches
Mail list logo