[omaha] Tutorial: Keyword Arguments

Jeff Hinrichs - DM&T jeffh at dundeemt.com
Sat Dec 1 17:38:45 CET 2007


because the language rules allow things like this:

def parrot(	voltage,
			state='a stiff',
			action='voom',
			type='NorwegianBlue'):
    print "-- This parrot wouldn't", action,
    print "if you put", voltage, "volts through it."
    print "-- Lovely plumage, the", type
    print "-- It's", state, "!"

Now you may be correct that you could infer without it, I've never
seen a discussion that talks about dropping the colon.  However, I
would bet that GvR has considered it and decided that it is
problematic without it.  However, the colon is a part of the language
definition.



On Dec 1, 2007 10:32 AM, Jay Hannah <jay at jays.net> wrote:
> On Dec 1, 2007, at 10:06 AM, Luke -Jr wrote:
> > On Saturday 01 December 2007, Jay Hannah wrote:
> >> Does the colon that starts every simple block have a purpose? (Isn't
> >> the mandatory indenting sufficient to tell the interpreter what it
> >> needs to know?)
> >
> > It's not mandatory if you do
> > if a: b()
>
> Can you do additional steps beyond b() somehow?
>
> Thanks,
>
>
> j
>
>
> _______________________________________________
> Omaha Python Users Group mailing list
> Omaha at python.org
> http://mail.python.org/mailman/listinfo/omaha
> http://www.OmahaPython.org
>



-- 
Jeff Hinrichs
Dundee Media & Technology, Inc
jeffh at dundeemt.com
402.218.1473


More information about the Omaha mailing list