Re: The need to put "self" in every method

2005-06-13 Thread D H
Steve Holden wrote: > Fernando M. wrote: > >> Hi, >> >> i was just wondering about the need to put "self" as the first >> parameter in every method a class has because, if it's always needed, >> why the obligation to write it? couldn't it be implicit? >> >> Or is it a special reason for this being

Re: The need to put "self" in every method

2005-06-05 Thread Aahz
In article <[EMAIL PROTECTED]>, Piet van Oostrum <[EMAIL PROTECTED]> wrote: >[EMAIL PROTECTED] (Aahz) (A) wrote: >> >> Any objection to swiping this for the FAQ? (Probably with some minor >> edits.) > >No. >The global/local stuff needs a bit more nuance (assignments in the method >being the crite

Re: The need to put "self" in every method

2005-06-03 Thread Ron Adam
Fernando M. wrote: > Hi, > > i was just wondering about the need to put "self" as the first > parameter in every method a class has because, if it's always needed, > why the obligation to write it? couldn't it be implicit? > > Or is it a special reason for this being this way? > > Thanks. Here'

Re: The need to put "self" in every method

2005-06-02 Thread Aahz
In article <[EMAIL PROTECTED]>, Peter Maas <[EMAIL PROTECTED]> wrote: >Aahz schrieb: >>> >>>Because Python has no declarations there must be a different way to >>>indicate in which category an identifier falls. >[...] >> Any objection to swiping this for the FAQ? (Probably with some minor >> edit

Re: The need to put "self" in every method

2005-06-02 Thread Peter Maas
Aahz schrieb: >>Because Python has no declarations there must be a different way to >>indicate in which category an identifier falls. [...] > Any objection to swiping this for the FAQ? (Probably with some minor > edits.) There is already a 'self' section (1.4.4) in the official Python FAQ. Looks

Re: The need to put "self" in every method

2005-06-02 Thread Peter Maas
Fernando M. schrieb: > i was just wondering about the need to put "self" as the first > parameter in every method a class has because, if it's always needed, > why the obligation to write it? couldn't it be implicit? > > Or is it a special reason for this being this way? See section 1.4.4 in http

Re: The need to put "self" in every method

2005-06-01 Thread spinach
>Explicit is better than implicit. import sarcasm def whatAboutMyImplicitModuleMethod() -- http://mail.python.org/mailman/listinfo/python-list

Re: The need to put "self" in every method

2005-06-01 Thread Piet van Oostrum
> [EMAIL PROTECTED] (Aahz) (A) wrote: >A> [posted & e-mailed] >A> In article <[EMAIL PROTECTED]>, >A> Piet van Oostrum <[EMAIL PROTECTED]> wrote: >>> >>> There is. >>> Inside a method there are 3 kinds of identifiers: >>> - local ones e.g. parameters and local variables >>> - global ones (ac

Re: The need to put "self" in every method

2005-06-01 Thread Max M
Aahz wrote: > [posted & e-mailed] > Any objection to swiping this for the FAQ? (Probably with some minor > edits.) I think it is missing the most important reason, that functions can act as unbound methods. -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mai

Re: The need to put "self" in every method

2005-06-01 Thread Max M
Terry Hancock wrote: > def __add__(a,b): > return Vector((a.x+b.x), (a.y+b.y), (a.z+b.z)) > > or something like that. I still have twinges of guilt about it, > though, and I had to write a long note in the comments, apologizing > and rationalizing a lot. ;-) Assigning self to a could have m

Re: The need to put "self" in every method

2005-06-01 Thread Terry Hancock
On Tuesday 31 May 2005 11:52 am, Roy Smith wrote: > Note that in languages like C++ where using "this->" is optional, > people invent their own conventions for keeping local and instance > variables distinct, like prepending m_ to member names (except that > different people do it different ways, s

Re: The need to put "self" in every method

2005-06-01 Thread Aahz
[posted & e-mailed] In article <[EMAIL PROTECTED]>, Piet van Oostrum <[EMAIL PROTECTED]> wrote: > >There is. >Inside a method there are 3 kinds of identifiers: >- local ones e.g. parameters and local variables >- global ones (actually module-level) >- instance variables and methods > >Because Pyt

Re: The need to put "self" in every method

2005-05-31 Thread John Machin
Skip Montanaro wrote: > Simon> Of course, if you *don't* use 'self', you should expect an angly > Simon> mob with pitchforks and torches outside your castle. > > I take it an "angly mob" is a large group of stick figures? > > Skip Yep -- straw men. -- http://mail.python.org/mailman/lis

Re: The need to put "self" in every method

2005-05-31 Thread Skip Montanaro
Simon> Of course, if you *don't* use 'self', you should expect an angly Simon> mob with pitchforks and torches outside your castle. I take it an "angly mob" is a large group of stick figures? Skip -- http://mail.python.org/mailman/listinfo/python-list

Re: The need to put "self" in every method

2005-05-31 Thread Peter Hansen
John Machin wrote: > Simon Brunning wrote: >> Of course, if you *don't* use 'self', you should expect an angly mob >> with pitchforks and torches outside your castle. > > Wouldn't an angly mob be carrying fishing rods? No, I rather think they'd be acutely obtuse, right? -- http://mail.python.org

Re: The need to put "self" in every method

2005-05-31 Thread Roy Smith
In article <[EMAIL PROTECTED]>, Carl Friedrich Bolz <[EMAIL PROTECTED]> wrote: > John Machin wrote: > > >>Of course, if you *don't* use 'self', you should expect an angly mob > >>with pitchforks and torches outside your castle. > >> > > > > Wouldn't an angly mob be carrying fishing rods? > > >

Re: The need to put "self" in every method

2005-05-31 Thread Carl Friedrich Bolz
John Machin wrote: >>Of course, if you *don't* use 'self', you should expect an angly mob >>with pitchforks and torches outside your castle. >> > > Wouldn't an angly mob be carrying fishing rods? > Well, I thought they would be carrying pitchfolks and tolches. -- http://mail.python.org/mailman

Re: The need to put "self" in every method

2005-05-31 Thread John Machin
Simon Brunning wrote: > On 31 May 2005 08:45:45 -0700, Fernando M. > <[EMAIL PROTECTED]> wrote: > >>i was just wondering about the need to put "self" as the first >>parameter in every method a class has because, if it's always needed, >>why the obligation to write it? > > > It doesn't need to be

Re: The need to put "self" in every method

2005-05-31 Thread Piet van Oostrum
> "Fernando M." <[EMAIL PROTECTED]> (FM) wrote: >FM> Hi, >FM> i was just wondering about the need to put "self" as the first >FM> parameter in every method a class has because, if it's always needed, >FM> why the obligation to write it? couldn't it be implicit? >FM> Or is it a special reason

Re: The need to put "self" in every method

2005-05-31 Thread Roy Smith
Fernando M. <[EMAIL PROTECTED]> wrote: >i was just wondering about the need to put "self" as the first >parameter in every method a class has because, if it's always needed, >why the obligation to write it? couldn't it be implicit? Didn't this exact question get asked just a few days ago? Anyway,

Re: The need to put "self" in every method

2005-05-31 Thread Erik Max Francis
Fernando M. wrote: > i was just wondering about the need to put "self" as the first > parameter in every method a class has because, if it's always needed, > why the obligation to write it? couldn't it be implicit? > > Or is it a special reason for this being this way? Because it's not always ne

Re: The need to put "self" in every method

2005-05-31 Thread Simon Brunning
On 31 May 2005 08:45:45 -0700, Fernando M. <[EMAIL PROTECTED]> wrote: > i was just wondering about the need to put "self" as the first > parameter in every method a class has because, if it's always needed, > why the obligation to write it? It doesn't need to be 'self'. You could use 'this', or 's

Re: The need to put "self" in every method

2005-05-31 Thread Steven Bethard
Fernando M. wrote: > i was just wondering about the need to put "self" as the first > parameter in every method a class has because, if it's always needed, > why the obligation to write it? couldn't it be implicit? py> import this The Zen of Python, by Tim Peters Beautiful is better than ugly. Ex

Re: The need to put "self" in every method

2005-05-31 Thread John Roth
"Fernando M." <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi, > > i was just wondering about the need to put "self" as the first > parameter in every method a class has because, if it's always needed, > why the obligation to write it? couldn't it be implicit? > > Or is it a speci

Re: The need to put "self" in every method

2005-05-31 Thread Steve Holden
Fernando M. wrote: > Hi, > > i was just wondering about the need to put "self" as the first > parameter in every method a class has because, if it's always needed, > why the obligation to write it? couldn't it be implicit? > > Or is it a special reason for this being this way? > > Thanks. > The

The need to put "self" in every method

2005-05-31 Thread Fernando M.
Hi, i was just wondering about the need to put "self" as the first parameter in every method a class has because, if it's always needed, why the obligation to write it? couldn't it be implicit? Or is it a special reason for this being this way? Thanks. -- http://mail.python.org/mailman/listinf