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


Groups > comp.lang.python > #18844 > unrolled thread

Re: your feedback to my first project please

Started byD'Arcy Cain <darcy@druid.net>
First post2012-01-11 14:14 -0500
Last post2012-01-11 14:14 -0500
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

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

#18844 — Re: your feedback to my first project please

FromD'Arcy Cain <darcy@druid.net>
Date2012-01-11 14:14 -0500
SubjectRe: your feedback to my first project please
Message-ID<mailman.4662.1326309283.27778.python-list@python.org>
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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web