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


Groups > comp.lang.python > #28965

Re: avoid the redefinition of a function

Date 2012-09-12 09:51 -0400
From D'Arcy Cain <darcy@druid.net>
Subject Re: avoid the redefinition of a function
References <CAOuJsMnLf4P9p_rZ4p1W-SndkSOV2WK_v5j1AET085LZ6bdavQ@mail.gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.561.1347458405.27098.python-list@python.org> (permalink)

Show all headers | View raw


On Wed, 12 Sep 2012 14:56:12 +0200
Jabba Laci <jabba.laci@gmail.com> wrote:
> This will call the 2nd function. Now my functions are called step_ID
> (like step_27(), step_28(), etc.). How to avoid the danger of
> redefinition? Now, when I write a new function, I search for its name
> to see if it's unique but there must be a better way.

I think your real problem is how you name your functions.  Give them
names that describe the operation that they do such as
step_get_finagle, step_update_konkle, etc.  It's harder to duplicate
those unless you actually duplicate a function and it will make your
code much easier to read.

-- 
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: avoid the redefinition of a function D'Arcy Cain <darcy@druid.net> - 2012-09-12 09:51 -0400

csiph-web