[Tutor] Opinion - help could use more examples

Chris “Kwpolska” Warrick kwpolska at gmail.com
Wed Jun 19 20:02:47 CEST 2013


On Wed, Jun 19, 2013 at 7:43 PM, Jim Mooney <cybervigilante at gmail.com> wrote:
> Here's a peeve of mine about Python help - it often has zero examples.
> I printed help(zip) to see what it does and got this:
>
>   Return a zip object whose .__next__() method returns a tuple where
>  |  the i-th element comes from the i-th iterable argument.  The .__next__()
>  |  method continues until the shortest iterable in the argument sequence
>  |  is exhausted and then it raises StopIteration.
>
> Not understandable right off, IMHO, unless you're already hardcore.
> Okay, I figured it out by running it with some iterables, so I didn't
> have to google around looking for examples. It would have saved time
> if there was just one example of what you would get from running
> next() on a zip or number lists a few times, since it's a simple
> concept. I'm coming from Jquery, which is chock full of examples, so
> everyone from bankers to pimps (if there is a difference) can use it.
> I think the name is confusing zip with compacting, too.
>
> Although to be fair.
> choosing_nth_item_from_parallel_sequences_until_there_is_no_match_on_n()
> might be too much typing compared to zip() ;')

A short explanation might be

    Iterate on arguments, if all return something yield whatever we
got, otherwise stop iterating.

But anyways, instead of using the built-in docs, refer to the
human-friendly documentation available on the web:
http://docs.python.org/3/library/functions.html?highlight=zip#zip

Downloads for those docs, if you believe this would be more convenient
for you, are available at http://docs.python.org/2/download.html and
http://docs.python.org/3/download.html (for Python 2 and 3
respectively)
--
Kwpolska <http://kwpolska.tk> | GPG KEY: 5EAAEA16
stop html mail                | always bottom-post
http://asciiribbon.org        | http://caliburn.nl/topposting.html


More information about the Tutor mailing list