[Zope] Re: Parameters for external methods and page templates
Paul Winkler
pw_lists@slinkp.com
Mon, 16 Sep 2002 08:37:21 -0700
On Mon, Sep 16, 2002 at 02:02:47PM +0200, Andreas Tille wrote:
> On Thu, 12 Sep 2002, Dieter Maurer wrote:
>
> > Andreas Tille writes:
> > > def MakeThumbHi2(self, image="bland.gif", width, height):
> > > ^^^^
> > This is invalid Python. You must not have arguments without default
> > after one with a default value.
> Thanks. This was the solution. Beeing not very familiar with python
> I've thought that self is an exception from this rule because this
> would mean that I can not have any default arguments if there is a
> self argument. Or can I use self even at the end of the parameter list?
No no no - you can't put self anywhere but at the beginning.
(In fact, self is not a keyword; it's a convention. You can
call the self-referencing variable anything you want, it's
just the first argument to a method.)
self is not the problem in your code. You don't have to give
a default value to the first argument, ever.
The problem in your case is that width and height do not
have default values, but they follow image, which does.
--
Paul Winkler
"Welcome to Muppet Labs, where the future is made - today!"