Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #18844

Re: your feedback to my first project please

Date 2012-01-11 14:14 -0500
From D'Arcy Cain <darcy@druid.net>
Subject Re: your feedback to my first project please
References <2123007772.204183.1326052009748.JavaMail.open-xchange@email.1und1.de
Newsgroups comp.lang.python
Message-ID <mailman.4662.1326309283.27778.python-list@python.org> (permalink)

Show all headers | View raw


On 12-01-08 02:46 PM, patrick@bierans.de wrote:
> Thanks for the feedback!

You're welcome.

>> D'Arcy wrote: [code examples]
> But I will keep some of my underscores for "private" attributes and methods.
> And I googled: "dim" was basic. I know too many languages and start mixing
> the keywords - shame on me. ;)

No problem but don't overuse the underscores.  It starts to look like
Perl.  The parameters to the methods and the local variables in the
methods will not pollute your namespace.  The only area you need to
concern yourself with is module level object references.

 >>> import mymodule
 >>> print dir(mymodule)

that's the list you need to be concerned with.  You will see that a lot
of names are already private.  In the case you present I don't think
that anything there was private that is not already private based on
what it inherits from object.

> Good Eye: I wrote the tests after coding - I know that this is the wrong way.
> I just wanted to start coding and after some time I decided that I shoud have
> some test cases. This is no real TDD - true. ;) I'll do that right next time.

This is the number one lesson you should take to heart from this.

> After thinking about it: Yupp. You are right. Having written tests to check
> "private" attributes really hurts one's pride. ;)

And you don't want to.  The test cases should make sure that public
objects and methods act as specified.  That's what allows you to
refactor any time you want.

-- 
D'Arcy J.M. Cain <darcy@druid.net>         |  Democracy is three wolves
http://www.druid.net/darcy/                |  and a sheep voting on
+1 416 425 1212     (DoD#0082)    (eNTP)   |  what's for dinner.
IM: darcy@Vex.Net

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: your feedback to my first project please D'Arcy Cain <darcy@druid.net> - 2012-01-11 14:14 -0500

csiph-web