Yet another newbie question - standard or built-in methods

John Roth newsgroups at jhrothjr.com
Fri Dec 5 13:27:03 CET 2003


"Kamus of Kadizhar" <yan at NsOeSiPnAeMr.com> wrote in message
news:bqpntf$bc8v$1 at news3.infoave.net...
> OK, I've been playing with the snippets of code posted earlier.
>
> Among them are things like
>
> allmovies[movie] = allmovies.get(movie, 0) + 1
>
>  From reading the docs, I've gathered that the '.get(xxx,yyy)' part is a
> method that operates on the dictonary allmovies.  (Sorry if I have the
> terminology wrong).
>
> But nowhere can I find a list of 'standard' or 'built-in' methods, or
> methods that can be used with various variable classes.

There are no standard methods that can be used across large
numbers of classes. The 'get' method you reference is specific
to mappings, that is, to dictionaries. Other objects that implement
a dictionary-like interface also implement it.

> What exactly
> does 'get' do?  This seems to be so basic to python that it's not
> explained anywhere, but that's no help to me.... Is there a list with
> explanations somewhere?  I've been through the tutorials and guides, and
> all just start using these with no explanation of what they do and how
> they work.
>
> Maybe I've missed it somewhere; just point me to the right FM, so I can
> RTFM.

Raymond pointed you at part of it: the full documentation set includes
a manual called the "Python Library Reference." That's the first thing
to read (well, at least skim heavily) after reading the tutorial.

John Roth
>
> help is no help:
>
> help> get
> no Python documentation found for 'get'
>
> So what's a newbie to do?
>
> -Kamus
>
> -- 
> What am I on?
> I'm on my bike,                         o__
> 6 hours a day, busting my ass.          ,>/'_
> What are you on? --Lance Armstrong     (_)\(_)
>






More information about the Python-list mailing list