"spir" <[EMAIL PROTECTED]> wrote
Actually, my question is so trivial that it is difficult to let you
understand
what I want. Imagine you know there is a "char_range" function that
returns a
char string -- provided you properly inform it about the range you
want. But,
as you do not know exactly its interface, you have to guess. How
would imagine
this function should be called? Or, how would you call it
spontaneously?
I wouldn't guess, I'd go into the interpreter and try using help() on
it.
Or I'd try something that wouldn't work (like not passing any args)
to see what it told me - usually the expected number of args for
example.
If we assume that the module where it is defined is not available
for inspection and there are no doc strings for help to grok then
and only then might I try guesswork, but more likely I'd just write
my own function or go look for another on the net!
Guessing a functions interface is so frought with danger that I just
wouldn't even try except in extremis.
If I was writing such a function from scratch and somebody gave
me your description as a spec I'd start off with something like:
def char_range(start, end):
# code here
Or maybe
def char_range(start, length):
# code...
Does that help in any way?
--
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor