Default indentation of 4 columns

François Pinard pinard at iro.umontreal.ca
Mon Nov 1 19:56:49 EST 1999


"Mark Hammond" <mhammond at skippinet.com.au> writes:

> However, look at "string.split.__doc__" - this does use a style
> similar to what Tim described and it is in .py code - and indeed does
> end up showing the arg information twice in the calltip window.

> So-basically-I-have-no-idea-what-Tim-meant<wink>-ly,

Hmph!  I see:


Python 1.5.2 (#1, Jul 23 1999, 06:38:16)  [GCC egcs-2.91.66 19990314/Linux (egcs- on linux2
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> print string.split.__doc__
split(str [,sep [,maxsplit]]) -> list of strings
splitfields(str [,sep [,maxsplit]]) -> list of strings

Return a list of the words in the string s, using sep as the
delimiter string.  If maxsplit is nonzero, splits into at most
maxsplit words If sep is not specified, any whitespace string
is a separator.  Maxsplit defaults to 0.

(split and splitfields are synonymous)


You see that `str' is used in the prototype, while `s' is used in the
description.  Such errors might be caught more easily by the eye if the
capitals convention was followed.  Compare (I'm using simili-GNU style):


split(STR [,SEP [,MAXSPLIT]]) -> list of strings
splitfields(STR [,SEP [,MAXSPLIT]]) -> list of strings

Return a list of the words in the string STR, using SEP as the
delimiter string.  If MAXSPLIT is nonzero, splits into at most
MAXSPLIT words.  If SEP is not specified, any whitespace string
is a separator.  MAXSPLIT defaults to 0.

(`split' and `splitfields' are synonymous.)


P.S. - If I were doing it, I would also write STRING and SEPARATOR in full.
Using smallish abbreviations come from prehistory :-) :-).

-- 
François Pinard   http://www.iro.umontreal.ca/~pinard






More information about the Python-list mailing list