Calling functions: Why this complicated ?

lkcl luke.leighton at googlemail.com
Sat Aug 1 19:19:55 EDT 2009


On Jul 14, 11:31 pm, Chris Rebert <c... at rebertia.com> wrote:
> On Tue, Jul 14, 2009 at 1:40 PM, Mohan Parthasarathy<surut... at gmail.com> wrote:
> > Hi,
> > I am a newbie. I am reading
> >http://www.network-theory.co.uk/docs/pytut/KeywordArguments.html
> > Defining a function with "N" arguments and calling them in "M" different
> > ways. Why does it have to be this complicated ? I like the idea of calling
> > the function by explicitly naming the arguments, but there are so many other
> > ways here that is very confusing. Do people really use all these features ?
> > Perhaps, there is a equivalent book to "Javascript: Good Parts" for Python ?
>
> Oh $DEITY, don't even compare Python toJavaScript. At least in
> Python, when you try to access a non-existent attribute, a proper
> NameError exception is thrown rather than silently getting back
> "undefined"... (*has traumatic horror story flashback*)

 yehh, that's what i thought, originally, but after talking it over
with the people doing the EMCAScript Harmony spec, they explained that
nooo, there _are_ exceptions thrown (two if the browser implements it
properly, which IE of course doesn't).  you can try it by installing
the spidermonkey js compiler, which is the exact same js engine that's
in firefox.

 in the python-to-javascript compiler, http://pyjs.org, however, we've
taken to adding a double-check (the equivalent of getattr) when you
specify the --strict option, juuust to make sure.

 and yes, there was a talk at europython 2009, pretty much called
"javascript, the good parts, for python programmers", you can look it
up, the talk audio is online by now.  http://europython.eu

 l.



More information about the Python-list mailing list