[Tutor] OOP clarification needed

Lie Ryan lie.1296 at gmail.com
Thu Jun 3 18:06:18 CEST 2010


On 06/03/10 01:37, Jim Byrnes wrote:
> 
>>> some older procedural languages I always end up becoming confused by
>>> the large number of built in methods.
>>
>> C is one of the simplest procedural languages around
>> and yet it comes with a huge library of functions (several
>> hundred in some cases). The size of the library should be easier
>> to manage using OOP than with older function/procedure based
>> libraries, because the functions are not just logically grouped
>> in the documentation but in the code too.
> 
> I don't know C, I was thinking more along the lines of Basic or Rexx.I
> could sit down and read through a list of keywords and built in
> functions and it would be compact enough that I would have a good idea
> of what was available.  I can't seem to do that with the OO languages,
> but of course  I am older now also.

When I learned Visual Basic, I definitely remembered the thousands of
pages of documentation for thousands of functions. Python is probably
isn't much different in the size of the number of functions included in
the stdlib, but IMHO help() and pydoc aids much better in navigating the
docs compared to context sensitive help.

Python's keywords are just:

help> keywords

Here is a list of the Python keywords.  Enter any keyword to get more help.

and                 elif                if                  print
as                  else                import              raise
assert              except              in                  return
break               exec                is                  try
class               finally             lambda              while
continue            for                 not                 with
def                 from                or                  yield
del                 global              pass

I don't think there are many non-esoteric languages with significantly
less keywords than python.

and the builtin functions:

abs  all  any  apply  basestring  bin  bool  buffer  bytearray  bytes
callable  chr  classmethod  cmp  coerce  compile  complex  delattr  dict
 dir  divmod  enumerate  eval  execfile  exit  file  filter  float
format  frozenset  getattr  globals  hasattr  hash  help  hex  id  input
 int  intern  isinstance  issubclass  iter  len  list  locals  long  map
 max  min  next  object  oct  open  ord  pow  print  property  quit
range  raw_input  reduce  reload  repr  reversed  round  set  setattr
slice  sorted  staticmethod  str  sum  super  tuple  type  unichr
unicode  vars  xrange  zip

and unlike some languages, the list of python's built-ins actually gets
smaller with py3k (84 items in 2.6.4 and 71 items in 3.1.2, excluding
Exceptions)

I never actually sit down and read through all the built-in function's
documentation; I just skim through this list, make a mental note of what
they appears to be doing from their name, and only read their
documentation as the need to use them arises.



More information about the Tutor mailing list