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


Groups > comp.lang.python > #28965

Re: avoid the redefinition of a function

Path csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!cs.uu.nl!news.stack.nl!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <darcy@druid.net>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.022
X-Spam-Evidence '*H*': 0.96; '*S*': 0.00; 'function,': 0.07; '425': 0.09; 'sep': 0.09; 'cc:addr:python-list': 0.10; 'read.': 0.13; '(like': 0.15; 'im:': 0.16; 'wed,': 0.16; 'wrote:': 0.17; 'duplicate': 0.17; '+0200': 0.20; 'voting': 0.22; 'cc:2**0': 0.23; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'functions.': 0.27; 'function': 0.30; 'code': 0.31; 'function.': 0.33; 'problem': 0.33; 'there': 0.35; 'but': 0.36; 'charset:us- ascii': 0.36; 'subject:: ': 0.38; 'easier': 0.38; 'called': 0.39; 'think': 0.40; 'your': 0.60; 'real': 0.61; 'header:Message-Id:1': 0.62; 'harder': 0.65; 'democracy': 0.84; 'received:98.158': 0.84
Date Wed, 12 Sep 2012 09:51:44 -0400
From D'Arcy Cain <darcy@druid.net>
To Jabba Laci <jabba.laci@gmail.com>
Subject Re: avoid the redefinition of a function
In-Reply-To <CAOuJsMnLf4P9p_rZ4p1W-SndkSOV2WK_v5j1AET085LZ6bdavQ@mail.gmail.com>
References <CAOuJsMnLf4P9p_rZ4p1W-SndkSOV2WK_v5j1AET085LZ6bdavQ@mail.gmail.com>
X-Mailer Sylpheed 3.2.0beta5 (GTK+ 2.24.10; x86_64-pc-linux-gnu)
Mime-Version 1.0
Content-Type text/plain; charset=US-ASCII
Content-Transfer-Encoding 7bit
Cc Python mailing list <python-list@python.org>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.561.1347458405.27098.python-list@python.org> (permalink)
Lines 18
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1347458405 news.xs4all.nl 6869 [2001:888:2000:d::a6]:38591
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:28965

Show key headers only | 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