Actually it has to do with what the helper function DIV expects / does with
it's arguments...
*arg expands a list, e.g. [a,b,c] and passes as 3 args;  that is, it unpacks
the list object;

Since python functions can also take keyword arguments  (arguments whose
position doesn't matter, and which a function definition may give a default
value), then this:

**kwarg  expands dictionaries (think of them as associative arrays) into
keywork argument pairs.

A good way to read the '*list is "expand the list", and **dict as "expand
the dictionary pairs (that is, the keyword:value pairs).

See more here:

http://www.network-theory.co.uk/docs/pytut/KeywordArguments.html
http://www.network-theory.co.uk/docs/pytut/UnpackingArgumentLists.html
http://www.network-theory.co.uk/docs/pytut/Dictionaries.html


Hope that is helpful.

Yarko

On Sat, Nov 8, 2008 at 10:38 PM, Jonathan Benn <[EMAIL PROTECTED]>wrote:

>
> On Nov 9, 7:19 am, billf <[EMAIL PROTECTED]> wrote:
>
> > Many thanks.  As you can see I'm still missing some Python basics.  I
> > wonder sometimes that any of my code works :-)
>
> I'm fairly new to Python myself, but my understanding is that this use
> of the asterisk (*) has to do with how the web2py function DIV was
> implemented.
>
> See this section of the tutorial for details:
> http://www.python.org/doc/2.5.2/tut/node6.html#SECTION006720000000000000000
>
>
> --Jonathan
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to