[Tutor] Detect duplicate object names
Alan Gauld
alan.gauld at btinternet.com
Thu Oct 22 09:42:41 CEST 2009
"Lizhi Yang" <yanglizhi at gmail.com> wrote
> When I define functions in a Module, how to avoid override the name of
> existing functions?
Do you mean other functions within the same module or do
you mean functions in other modules?
For the first case, keep the number of functions to a reasonable number
so you can remember what's in there, and use classes top group related
functions together. If you have too many functions in a single module it
gets difficult for the module user to remember them too so its a good
idea to split big modules up when they get too busy.
For the second case you don;t need to woory because thats why we
use modules - to separate out the namespaces. So if you have two
functions f() inn two modules A and B you just import A and B and
access A.f() and B.f()
> For example:
>
> define func1():
> define func2():
> define func1():
>
> Is there anyway to pop up the warnings?
Kent mentioned support tools already.
--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/
More information about the Tutor
mailing list