Re: Guido's new method definition idea

2008-12-15 Thread Ken Seehart
-*ε* Admittedly a tough call. I see the attraction of the proposed syntax. Maybe somewhat more readable since the declaration syntax matches the usage syntax, which is nice. I think it would have been superior to the current syntax if it had been done that way in the first place. However, sin

Re: Guido's new method definition idea

2008-12-09 Thread Lie Ryan
On Mon, 08 Dec 2008 20:55:16 +, Arnaud Delobelle wrote: > [EMAIL PROTECTED] writes: > >> class C: >> def createfunc(self): >> def self.func(arg): >> return arg + 1 >> >> Or, after the class definition is done, to extend it dynamically: >> >> def C.method(self, arg): >>

Re: Guido's new method definition idea

2008-12-09 Thread ptn
On Dec 6, 10:15 am, "Russ P." <[EMAIL PROTECTED]> wrote: > On Dec 6, 4:32 am, Andreas Waldenburger <[EMAIL PROTECTED]> wrote: > > > > > On Sat, 6 Dec 2008 04:02:54 -0800 (PST) [EMAIL PROTECTED] wrote: > > > > class C: > > >     def $method(arg): > > >         $value = arg > > > > (Note there's no p

Re: Guido's new method definition idea

2008-12-09 Thread Antoine De Groote
[EMAIL PROTECTED] wrote: > On Dec 6, 4:15 pm, Carl Banks <[EMAIL PROTECTED]> wrote: [...] > > This brings up another question, what would one use when referencing > method names inside the class definition?: > > class C: > def self.method(arg): > self.value = arg > def self.othe

Re: Guido's new method definition idea

2008-12-09 Thread Bruno Desthuilliers
william tanksley a écrit : On Dec 5, 6:21 pm, "Daniel Fetchinson" <[EMAIL PROTECTED]> wrote: I'd like this new way of defining methods, what do you guys think? Anyone ready for writing a PEP? I think it's an awesome proposal. It's about time! With this change, defining methods uses the same sp

Re: Guido's new method definition idea

2008-12-09 Thread Aaron Brady
On Dec 8, 6:43 pm, william tanksley <[EMAIL PROTECTED]> wrote: > On Dec 5, 6:21 pm, "Daniel Fetchinson" <[EMAIL PROTECTED]> > wrote: > > > I'd like this new way of defining methods, what do you guys think? > > Anyone ready for writing a PEP? snip > > I see a lot of people are against it; I admit th

Re: Guido's new method definition idea

2008-12-08 Thread Alex_Gaynor
I'm a huge -1 on this, it adds nothing to the language, and IMO violates quite a few Zens. -Beautiful is better than ugly. A bit subjective, but this is ugly IMO. -Special cases aren't special enough to break the rules. -There should be one-- and preferably only one --obvious way to do it. -- http

Re: Guido's new method definition idea

2008-12-08 Thread greg
[EMAIL PROTECTED] wrote: On another related note, I would be interested in seeing this syntax adopted for a different purpose... class C: def createfunc(self): def self.func(arg): return arg + 1 I agree -- this would be a much better use of the syntax, and I'd like to

Re: Guido's new method definition idea

2008-12-08 Thread william tanksley
On Dec 5, 6:21 pm, "Daniel Fetchinson" <[EMAIL PROTECTED]> wrote: > I'd like this new way of defining methods, what do you guys think? > Anyone ready for writing a PEP? I think it's an awesome proposal. It's about time! With this change, defining methods uses the same special syntax hack that call

Re: Guido's new method definition idea

2008-12-08 Thread Aaron Brady
On Dec 8, 2:55 pm, Arnaud Delobelle <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] writes: > > class C: > >     def createfunc(self): > >         def self.func(arg): > >             return arg + 1 > > > Or, after the class definition is done, to extend it dynamically: > > > def C.method(self, arg):

RE: Guido's new method definition idea

2008-12-08 Thread Reedick, Andrew
> -Original Message- > From: [EMAIL PROTECTED] [mailto:python- > [EMAIL PROTECTED] On Behalf Of Aaron Brady > Sent: Monday, December 08, 2008 3:27 PM > To: python-list@python.org > Subject: Re: Guido's new method definition idea > > On Dec 7, 4:23 pm, P

Re: Guido's new method definition idea

2008-12-08 Thread Patrick Mullen
On Mon, Dec 8, 2008 at 12:55 PM, Arnaud Delobelle <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] writes: > >> class C: >> def createfunc(self): >> def self.func(arg): >> return arg + 1 >> >> Or, after the class definition is done, to extend it dynamically: >> >> def C.method

Re: Guido's new method definition idea

2008-12-08 Thread Arnaud Delobelle
[EMAIL PROTECTED] writes: > class C: > def createfunc(self): > def self.func(arg): > return arg + 1 > > Or, after the class definition is done, to extend it dynamically: > > def C.method(self, arg): > self.value = arg > > ...which would be the equivalent of the followin

Re: Guido's new method definition idea

2008-12-08 Thread Aaron Brady
On Dec 7, 4:23 pm, Philip Slate <[EMAIL PROTECTED]> wrote: > On Dec 7, 1:13 pm, Bruno Desthuilliers > > <[EMAIL PROTECTED]> wrote: > > > and friendlier to newbies. > > > I'd rather say "more acceptable to java-brainwashed developpers". > > And I'd rather say you're trolling, but that's ok since you

Re: Guido's new method definition idea

2008-12-08 Thread Ben Kaplan
On Dec 8, 2008, at 11:59 AM, [EMAIL PROTECTED] wrote: On Dec 6, 4:15 pm, Carl Banks <[EMAIL PROTECTED]> wrote: On Dec 6, 12:47 am, "Patrick Mullen" <[EMAIL PROTECTED]> wrote: Could I do something like this: def a.add(b): return a+b Outside of a class? Of course then that makes you thi

Re: Guido's new method definition idea

2008-12-08 Thread anthony . tolle
On Dec 8, 12:01 pm, [EMAIL PROTECTED] wrote: > > It would be nice to be able to do the following instead: > > class C: >     def createfunc(self): >         def self.func(arg): >             return arg + 1 > The above example should have read as follows: class C: def createfunc(self, arg):

Re: Guido's new method definition idea

2008-12-08 Thread anthony . tolle
On Dec 6, 4:15 pm, Carl Banks <[EMAIL PROTECTED]> wrote: > On Dec 6, 12:47 am, "Patrick Mullen" <[EMAIL PROTECTED]> wrote: > > > Could I do something like this: > > > def a.add(b): return a+b > > > Outside of a class?  Of course then that makes you think you could do > > 5.add(6) or something craaa

Re: Guido's new method definition idea

2008-12-08 Thread anthony . tolle
On Dec 6, 4:15 pm, Carl Banks <[EMAIL PROTECTED]> wrote: > On Dec 6, 12:47 am, "Patrick Mullen" <[EMAIL PROTECTED]> wrote: > > > Could I do something like this: > > > def a.add(b): return a+b > > > Outside of a class?  Of course then that makes you think you could do > > 5.add(6) or something craaa

Re: Guido's new method definition idea

2008-12-08 Thread Christopher
> > I'd like this new way of defining methods, what do you guys think? > Anyone ready for writing a PEP? I don't really see any advantage. IMHO, it is not clearer, it is not more concise, it makes the definition of class shared variables look really out of place. It also makes the new programmer

Re: Guido's new method definition idea

2008-12-08 Thread Almar Klein
I like the transparancy and clearity of python, and the explicit self fits beautifully. Allowing a second way of defining your methods would only confuse newbies more I would think. I was a newby only half a year ago (or maybe I still am). The explicit self seems weird the very first time you see

Re: Guido's new method definition idea

2008-12-08 Thread Bruno Desthuilliers
Philip Slate a écrit : On Dec 7, 1:13 pm, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: and friendlier to newbies. I'd rather say "more acceptable to java-brainwashed developpers". And I'd rather say you're trolling, Almost, indeed. But not as much as you !-) -- http://mail.python.org/ma

Re: Guido's new method definition idea

2008-12-08 Thread Lie Ryan
On Sun, 07 Dec 2008 18:27:21 +0100, Andreas Waldenburger wrote: > On Sat, 6 Dec 2008 23:21:04 -0800 (PST) Lie <[EMAIL PROTECTED]> wrote: > >> I think we have to test this on newbies. [snip] >> > Now that's talking like a programmer! > > Ideas on how such a survey could be conducted? Anyone? >

Re: Guido's new method definition idea

2008-12-07 Thread Lie Ryan
On Sun, 07 Dec 2008 12:57:27 +0100, News123 wrote: > Lie wrote: >> On Dec 7, 1:02 am, News123 <[EMAIL PROTECTED]> wrote: >>> What would be interesting would be some syntactical sugar to get rid >>> of the 'self' (at least in the code body). >>> >>> example: >>> class C: >>> class_elements a,b,

Re: Guido's new method definition idea

2008-12-07 Thread Lie Ryan
On Sun, 07 Dec 2008 20:56:40 +, I V wrote: > So, if we want Python to the programming language of choice for Lacanian > psychoanalysts, perhaps we should adopt the symbol "$" (or even, with > Python 3's support for unicode identifiers, S followed by U+0388) > instead of "self." Is that suppos

Re: Guido's new method definition idea

2008-12-07 Thread Philip Slate
On Dec 7, 1:13 pm, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > > and friendlier to newbies. > > I'd rather say "more acceptable to java-brainwashed developpers". And I'd rather say you're trolling, but that's ok since you're preaching to the converted. You conveniently forgot to mention the

Re: Guido's new method definition idea

2008-12-07 Thread Andreas Waldenburger
On Sun, 07 Dec 2008 20:56:40 GMT I V <[EMAIL PROTECTED]> wrote: > So, if we want Python to the programming language of choice for > Lacanian psychoanalysts, perhaps we should adopt the symbol "$" (or > even, with Python 3's support for unicode identifiers, S followed by > U+0388) instead of "self."

Re: Guido's new method definition idea

2008-12-07 Thread I V
On Sat, 06 Dec 2008 16:34:56 -0800, Erik Max Francis wrote: > `$` as a shortcut for self, on the other hand, gives absolutely no > mnemonic indication what it stands for, and users would be simply left > guessing. However, $ is sometimes used as an alternative way of writing S̸ (I've attempted to

Re: Guido's new method definition idea

2008-12-07 Thread Brian Blais
On Dec 5, 2008, at 21:21 , Daniel Fetchinson wrote: The proposal is to allow this: class C: def self.method( arg ): self.value = arg return self.value instead of this: class C: def method( self, arg ): self.value = arg return self.value I have never

Re: Guido's new method definition idea

2008-12-07 Thread Antoine De Groote
Bruno Desthuilliers wrote: > Daniel Fetchinson a écrit : > (snip) >> It doesn't add anything but makes something that exists a bit clearer > > Err... I fail to see how magically transforming def self.foo(...) into > def foo(self, ...) makes anything clearer about what really happens and > how Py

Re: Guido's new method definition idea

2008-12-07 Thread Bruno Desthuilliers
Daniel Fetchinson a écrit : (snip) Still, improved error messages would be desirable (concerning the number of arguments passed to an instance method). Then count me as +2 on this !-) -- http://mail.python.org/mailman/listinfo/python-list

Re: Guido's new method definition idea

2008-12-07 Thread Daniel Fetchinson
The story of the explicit self in method definitions has been discussed to death and we all know it will stay. However, Guido himself acknowledged that an alternative syntax makes perfect sense and having both (old and new) in a future version of python is a possibility sin

Re: Guido's new method definition idea

2008-12-07 Thread Bruno Desthuilliers
Daniel Fetchinson a écrit : Hi folks, The story of the explicit self in method definitions has been discussed to death and we all know it will stay. However, Guido himself acknowledged that an alternative syntax makes perfect sense and having both (old and new) in a future version of python is a

Re: Guido's new method definition idea

2008-12-07 Thread Bruno Desthuilliers
News123 a écrit : Lie wrote: On Dec 7, 1:02 am, News123 <[EMAIL PROTECTED]> wrote: What would be interesting would be some syntactical sugar to get rid of the 'self' (at least in the code body). This has been debated to hell and back. And it's *not* going to happen. example: class C: cl

Re: Guido's new method definition idea

2008-12-07 Thread Andreas Waldenburger
On Sun, 07 Dec 2008 19:13:18 +0100 Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > > and friendlier to newbies. > > I'd rather say "more acceptable to java-brainwashed developpers". Why would you rather be unfriendly and seed ambivalence? I do see the fun in a little Python snobbism, but ... c

Re: Guido's new method definition idea

2008-12-07 Thread Bruno Desthuilliers
Daniel Fetchinson a écrit : (snip) It doesn't add anything but makes something that exists a bit clearer Err... I fail to see how magically transforming def self.foo(...) into def foo(self, ...) makes anything clearer about what really happens and how Python's object model works. and friend

Re: Guido's new method definition idea

2008-12-07 Thread Daniel Fetchinson
>>> Hi folks, >>> >>> The story of the explicit self in method definitions has been >>> discussed to death and we all know it will stay. However, Guido >>> himself acknowledged that an alternative syntax makes perfect sense >>> and having both (old and new) in a future version of python is a >>> po

Re: Guido's new method definition idea

2008-12-07 Thread Andreas Waldenburger
On Sat, 6 Dec 2008 23:21:04 -0800 (PST) Lie <[EMAIL PROTECTED]> wrote: > I think we have to test this on newbies. [snip] > Now that's talking like a programmer! Ideas on how such a survey could be conducted? Anyone? > If this dead horse is revived because of that reason, then I'd go with > cha

Re: Guido's new method definition idea

2008-12-07 Thread Andreas Waldenburger
On Sun, 07 Dec 2008 02:49:27 -0500 acerimusdux <[EMAIL PROTECTED]> wrote: > I'm not sure though whether allowing both syntaxes would make things > more or less confusing. It might actually be helpful in some respects > for newcomers to realize that self.method(arg) is somewhat the same > as meth

Re: Guido's new method definition idea

2008-12-07 Thread Arnaud Delobelle
Erik Max Francis <[EMAIL PROTECTED]> writes: [about removing self] > P.S. You're beating a long-dead horse here; your precise proposal has > been brought up countless times on comp.lang.python and shot down > every single time for the same reason. It isn't going to happen. I guess it's part of t

Re: Guido's new method definition idea

2008-12-07 Thread Steven D'Aprano
On Sun, 07 Dec 2008 12:43:13 +0100, News123 wrote: > Sorry Dennis, > > > I don't understand your answer. > I'm not very knowledgable with all the OO vocabulary, but just use OO. > > self.a , self.b , self.c are stored in the object and could later be > used by other object-methods. In Python

Re: Guido's new method definition idea

2008-12-07 Thread News123
Lie wrote: > On Dec 7, 1:02 am, News123 <[EMAIL PROTECTED]> wrote: >> What would be interesting would be some syntactical sugar to get rid of >> the 'self' (at least in the code body). >> >> example: >> class C: >> class_elements a,b,c,d >> >> def method(self,arg): >> global d >>

Re: Guido's new method definition idea

2008-12-07 Thread News123
Sorry Dennis, I don't understand your answer. I'm not very knowledgable with all the OO vocabulary, but just use OO. self.a , self.b , self.c are stored in the object and could later be used by other object-methods. like def print_a_b_c(self): print self,a,self.b,self.c the name 'cla

Re: Re: Guido's new method definition idea

2008-12-06 Thread acerimusdux
Russ P. wrote: Python already uses shorthand extensively. How about "def"? For people who are so worried about self-explanatory symbols, what the heck does that stand for? Default? Defeat? Defect? Defunct? Defer? I think the difference here is that those other abbreviations are mostly fa

Re: Guido's new method definition idea

2008-12-06 Thread Lie
On Dec 6, 9:21 am, "Daniel Fetchinson" <[EMAIL PROTECTED]> wrote: > Hi folks, > > The story of the explicit self in method definitions has been > discussed to death and we all know it will stay. However, Guido > himself acknowledged that an alternative syntax makes perfect sense > and having both (

Re: Guido's new method definition idea

2008-12-06 Thread Lie
On Dec 7, 1:02 am, News123 <[EMAIL PROTECTED]> wrote: > What would be interesting would be some syntactical sugar to get rid of > the 'self' (at least in the code body). > > example: > class C: >     class_elements a,b,c,d > >     def method(self,arg): >         global d >         a,b,c = arg[0..3]

Re: Guido's new method definition idea

2008-12-06 Thread Cameron Simpson
On 06Dec2008 11:30, Andreas Waldenburger <[EMAIL PROTECTED]> wrote: | On 6 Dec 2008 09:18:20 GMT Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> | wrote: | > On Sat, 06 Dec 2008 09:56:12 +0100, Antoine De Groote wrote: | > [snip reference to "preferably only one way to do it"] | > | > The reason why

Re: Guido's new method definition idea

2008-12-06 Thread Carl Banks
On Dec 6, 6:42 pm, "Russ P." <[EMAIL PROTECTED]> wrote: > > But it's ugly.  No amount of rationalization will make it not ugly. > > The dollar sign is ugly? I beg to differ. Nope, you're wrong. Carl Banks (See where this is going?) -- http://mail.python.org/mailman/listinfo/python-list

Re: Guido's new method definition idea

2008-12-06 Thread Jeremiah Dodds
On Fri, Dec 5, 2008 at 9:21 PM, Daniel Fetchinson <[EMAIL PROTECTED] > wrote: > > The proposal is to allow this: > > class C: >def self.method( arg ): >self.value = arg >return self.value > > instead of this: > > class C: >def method( self, arg ): >self.value = arg

Re: Guido's new method definition idea

2008-12-06 Thread bearophileHUGS
Erik Max Francis: > your precise proposal has > been brought up countless times on comp.lang.python And something tells me that it will keep coming up many more times in the following years too. Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list

Re: Guido's new method definition idea

2008-12-06 Thread Rhodri James
On Sat, 06 Dec 2008 21:51:51 -, Daniel Fetchinson <[EMAIL PROTECTED]> wrote: Did you read the blog post? The advantage is having a less confusing situation for newbies (confusing the number of arguments to a method call). Experience suggests that newbies don't find this confusing, or at

Re: Guido's new method definition idea

2008-12-06 Thread Russ P.
> But it's ugly.  No amount of rationalization will make it not ugly. The dollar sign is ugly? I beg to differ. -- http://mail.python.org/mailman/listinfo/python-list

Re: Guido's new method definition idea

2008-12-06 Thread Erik Max Francis
Russ P. wrote: On Dec 6, 4:32 am, Andreas Waldenburger <[EMAIL PROTECTED]> wrote: But that is not the way Python is meant to work. There are several tennets in the Zen of Python that don't chime well with this approach. "self" is a speaking identifier, "$" isn't. Is "@" a "speaking identifier?

Re: Guido's new method definition idea

2008-12-06 Thread Erik Max Francis
Russ P. wrote: Python already uses shorthand extensively. How about "def"? For people who are so worried about self-explanatory symbols, what the heck does that stand for? Default? Defeat? Defect? Defunct? Defer? That's pretty silly; it's pretty obvious that `def` means "define," and even if

Re: Guido's new method definition idea

2008-12-06 Thread Carl Banks
On Dec 6, 4:39 pm, "Russ P." <[EMAIL PROTECTED]> wrote: > On Dec 6, 1:21 pm, Carl Banks <[EMAIL PROTECTED]> wrote: > > > > > On Dec 6, 9:12 am, "Russ P." <[EMAIL PROTECTED]> wrote: > > > > On Dec 6, 1:02 am, Antoine De Groote <[EMAIL PROTECTED]> wrote: > > > > > Allowing "$" as a substitute for "se

Re: Guido's new method definition idea

2008-12-06 Thread Steven D'Aprano
On Sat, 06 Dec 2008 08:01:40 -0800, Russ P. wrote: >> -2 on this proposal. > > Did you get two votes in the Presidential election too? 8^) You know, occasionally you stumble across people on the Internet who aren't from the USA. Some of us even speak English almost as good as native speakers *

Re: Guido's new method definition idea

2008-12-06 Thread Andreas Waldenburger
On Sat, 6 Dec 2008 14:39:34 -0800 (PST) "Russ P." <[EMAIL PROTECTED]> wrote: > I don't know much about Perl, but my understanding is that a dollar > sign must be used every time a variable is dereferenced, as in bash or > other shell languages. What we are proposing here is something > entirely di

Re: Guido's new method definition idea

2008-12-06 Thread Benjamin Kaplan
On Sat, Dec 6, 2008 at 4:51 PM, Daniel Fetchinson <[EMAIL PROTECTED] > wrote: > >> Hi folks, > >> > >> The story of the explicit self in method definitions has been > >> discussed to death and we all know it will stay. However, Guido > >> himself acknowledged that an alternative syntax makes perfe

Re: Guido's new method definition idea

2008-12-06 Thread Russ P.
On Dec 6, 1:21 pm, Carl Banks <[EMAIL PROTECTED]> wrote: > On Dec 6, 9:12 am, "Russ P." <[EMAIL PROTECTED]> wrote: > > > > > On Dec 6, 1:02 am, Antoine De Groote <[EMAIL PROTECTED]> wrote: > > > > Allowing "$" as a substitute for "self" wouldn't require this new syntax. > > > > class C: > > >     d

Re: Guido's new method definition idea

2008-12-06 Thread Chris Rebert
On Sat, Dec 6, 2008 at 1:33 PM, Carl Banks <[EMAIL PROTECTED]> wrote: > On Dec 5, 8:21 pm, "Daniel Fetchinson" <[EMAIL PROTECTED]> > wrote: >> Hi folks, >> >> The story of the explicit self in method definitions has been >> discussed to death and we all know it will stay. However, Guido >> himself

Re: Guido's new method definition idea

2008-12-06 Thread Daniel Fetchinson
>> Hi folks, >> >> The story of the explicit self in method definitions has been >> discussed to death and we all know it will stay. However, Guido >> himself acknowledged that an alternative syntax makes perfect sense >> and having both (old and new) in a future version of python is a >> possibili

Re: Guido's new method definition idea

2008-12-06 Thread Daniel Fetchinson
> Bad idea having two ways to do this. Pick one or the other! Maybe only this alternative syntax for python 4000? -- Psss, psss, put it down! - http://www.cafepress.com/putitdown -- http://mail.python.org/mailman/listinfo/python-list

Re: Guido's new method definition idea

2008-12-06 Thread Daniel Fetchinson
>> Hi folks, >> >> The story of the explicit self in method definitions has been >> discussed to death and we all know it will stay. However, Guido >> himself acknowledged that an alternative syntax makes perfect sense >> and having both (old and new) in a future version of python is a >> possibili

Re: Guido's new method definition idea

2008-12-06 Thread Carl Banks
On Dec 5, 8:21 pm, "Daniel Fetchinson" <[EMAIL PROTECTED]> wrote: > Hi folks, > > The story of the explicit self in method definitions has been > discussed to death and we all know it will stay. However, Guido > himself acknowledged that an alternative syntax makes perfect sense > and having both (

Re: Guido's new method definition idea

2008-12-06 Thread Carl Banks
On Dec 6, 9:12 am, "Russ P." <[EMAIL PROTECTED]> wrote: > On Dec 6, 1:02 am, Antoine De Groote <[EMAIL PROTECTED]> wrote: > > > > > Allowing "$" as a substitute for "self" wouldn't require this new syntax. > > > class C: > >     def method($, arg): > >         $.value = arg > > > I'm strongly again

Re: Guido's new method definition idea

2008-12-06 Thread Carl Banks
On Dec 6, 9:15 am, "Russ P." <[EMAIL PROTECTED]> wrote: > On Dec 6, 4:32 am, Andreas Waldenburger <[EMAIL PROTECTED]> wrote: > > > > > On Sat, 6 Dec 2008 04:02:54 -0800 (PST) [EMAIL PROTECTED] wrote: > > > > class C: > > >     def $method(arg): > > >         $value = arg > > > > (Note there's no po

Re: Guido's new method definition idea

2008-12-06 Thread Carl Banks
On Dec 6, 12:47 am, "Patrick Mullen" <[EMAIL PROTECTED]> wrote: > Could I do something like this: > > def a.add(b): return a+b > > Outside of a class?  Of course then that makes you think you could do > 5.add(6) or something crzy like that.  (I mean, you can do > (5).__add__(6) but that's somet

Re: Guido's new method definition idea

2008-12-06 Thread MRAB
Neal Becker wrote: Daniel Fetchinson wrote: Hi folks, The story of the explicit self in method definitions has been discussed to death and we all know it will stay. However, Guido himself acknowledged that an alternative syntax makes perfect sense and having both (old and new) in a future vers

Re: Guido's new method definition idea

2008-12-06 Thread News123
Daniel Fetchinson wrote: > The proposal is to allow this: > > class C: > def self.method( arg ): > self.value = arg > return self.value > > instead of this: > > class C: > def method( self, arg ): > self.value = arg > return self.value Hmm, I'd give the p

Re: Guido's new method definition idea

2008-12-06 Thread Neal Becker
Daniel Fetchinson wrote: > Hi folks, > > The story of the explicit self in method definitions has been > discussed to death and we all know it will stay. However, Guido > himself acknowledged that an alternative syntax makes perfect sense > and having both (old and new) in a future version of pyt

Re: Guido's new method definition idea

2008-12-06 Thread Tommy Grav
On Dec 6, 2008, at 11:42 AM, [EMAIL PROTECTED] wrote: class ThisIsAClass: def $some_method(arg1, arg2): $value = arg1 + $foo + $bar + $baz * arg2 ... I think my biggest problem with this is what got me off Perl. Add $, together with already used @ and maybe some other identifiers

Re: Guido's new method definition idea

2008-12-06 Thread r
Bad idea having two ways to do this. Pick one or the other! -- http://mail.python.org/mailman/listinfo/python-list

Re: Guido's new method definition idea

2008-12-06 Thread bearophileHUGS
Steven D'Aprano: > If a line of code uses too many instance attributes to fit comfortably on > a line, spread it over two lines. There is no newline shortage, they are > a renewable resource. Splitting lines is generally possible, but sometimes it's not I want, for example to keep a formula whole.

Re: Guido's new method definition idea

2008-12-06 Thread Russ P.
On Dec 6, 7:34 am, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Sat, 06 Dec 2008 07:15:27 -0800, Russ P. wrote: > > On Dec 6, 4:32 am, Andreas Waldenburger <[EMAIL PROTECTED]> wrote: > >> On Sat, 6 Dec 2008 04:02:54 -0800 (PST) [EMAIL PROTECTED] wrote: > > >> > class C: > >> >

Re: Guido's new method definition idea

2008-12-06 Thread Antoine De Groote
Russ P. wrote: > On Dec 6, 1:02 am, Antoine De Groote <[EMAIL PROTECTED]> wrote: >> Allowing "$" as a substitute for "self" wouldn't require this new syntax. >> >> class C: >> def method($, arg): >> $.value = arg >> >> I'm strongly against this. This looks ugly and reminds me of Perl an

Re: Guido's new method definition idea

2008-12-06 Thread Bruno Desthuilliers
Daniel Fetchinson a écrit : Hi folks, The story of the explicit self in method definitions has been discussed to death and we all know it will stay. However, Guido himself acknowledged that an alternative syntax makes perfect sense and having both (old and new) in a future version of python is a

Re: Guido's new method definition idea

2008-12-06 Thread Steven D'Aprano
On Sat, 06 Dec 2008 07:15:27 -0800, Russ P. wrote: > On Dec 6, 4:32 am, Andreas Waldenburger <[EMAIL PROTECTED]> wrote: >> On Sat, 6 Dec 2008 04:02:54 -0800 (PST) [EMAIL PROTECTED] wrote: >> >> > class C: >> >     def $method(arg): >> >         $value = arg >> >> > (Note there's no point after $,

Re: Guido's new method definition idea

2008-12-06 Thread Russ P.
On Dec 6, 4:37 am, Andreas Waldenburger <[EMAIL PROTECTED]> wrote: > On Sat, 6 Dec 2008 13:32:58 +0100 Andreas Waldenburger > > <[EMAIL PROTECTED]> wrote: > > On Sat, 6 Dec 2008 04:02:54 -0800 (PST) [EMAIL PROTECTED] > > suggested: > > > > class C: > > >     def $method(arg): > > >         $value =

Re: Guido's new method definition idea

2008-12-06 Thread Russ P.
On Dec 6, 4:32 am, Andreas Waldenburger <[EMAIL PROTECTED]> wrote: > On Sat, 6 Dec 2008 04:02:54 -0800 (PST) [EMAIL PROTECTED] wrote: > > > class C: > >     def $method(arg): > >         $value = arg > > > (Note there's no point after $, it's not currently possible). > > Ruby uses @ and @@ for simi

Re: Guido's new method definition idea

2008-12-06 Thread Russ P.
On Dec 6, 1:02 am, Antoine De Groote <[EMAIL PROTECTED]> wrote: > Allowing "$" as a substitute for "self" wouldn't require this new syntax. > > class C: >     def method($, arg): >         $.value = arg > > I'm strongly against this. This looks ugly and reminds me of Perl and > Ruby. (I don't have

Re: Guido's new method definition idea

2008-12-06 Thread John Roth
On Dec 5, 7:21 pm, "Daniel Fetchinson" <[EMAIL PROTECTED]> wrote: > Hi folks, > > The story of the explicit self in method definitions has been > discussed to death and we all know it will stay. However, Guido > himself acknowledged that an alternative syntax makes perfect sense > and having both (

Re: Guido's new method definition idea

2008-12-06 Thread Colin J. Williams
Daniel Fetchinson wrote: Hi folks, The story of the explicit self in method definitions has been discussed to death and we all know it will stay. However, Guido himself acknowledged that an alternative syntax makes perfect sense and having both (old and new) in a future version of python is a po

Re: Guido's new method definition idea

2008-12-06 Thread Hendrik van Rooyen
"James Stroud" wrote: > Consider the maverick who insists on 8 What's the interpreter going to do with our maverick's code? Took me a while, but after I remembered that a "maverick" is an unmarked, wild member of the bovine species that is

Re: Guido's new method definition idea

2008-12-06 Thread Antoine De Groote
Aaron Brady wrote: > On Dec 5, 8:21 pm, "Daniel Fetchinson" <[EMAIL PROTECTED]> > wrote: >> Hi folks, >> >> The story of the explicit self in method definitions has been >> discussed to death and we all know it will stay. However, Guido >> himself acknowledged that an alternative syntax makes per

Re: Guido's new method definition idea

2008-12-06 Thread Antoine De Groote
[EMAIL PROTECTED] wrote: > Antoine De Groote: >> Allowing "$" as a substitute for "self" wouldn't require this new syntax. >> class C: >> def method($, arg): >> $.value = arg > > I think this (that is just sugar) may be a little better: > > class C: > def method($, arg): >

Re: Guido's new method definition idea

2008-12-06 Thread Andreas Waldenburger
On Sat, 6 Dec 2008 13:32:58 +0100 Andreas Waldenburger <[EMAIL PROTECTED]> wrote: > On Sat, 6 Dec 2008 04:02:54 -0800 (PST) [EMAIL PROTECTED] > suggested: > > > > class C: > > def $method(arg): > > $value = arg > > > > [snip] > > > [snip] > "self" is a speaking identifier, "$" isn'

Re: Guido's new method definition idea

2008-12-06 Thread Andreas Waldenburger
On Sat, 6 Dec 2008 04:02:54 -0800 (PST) [EMAIL PROTECTED] wrote: > class C: > def $method(arg): > $value = arg > > (Note there's no point after $, it's not currently possible). > Ruby uses @ and @@ for similar purposes. > I agree that the code looks worse, but also shorter to read an

Re: Guido's new method definition idea

2008-12-06 Thread Aaron Brady
On Dec 5, 8:21 pm, "Daniel Fetchinson" <[EMAIL PROTECTED]> wrote: > Hi folks, > > The story of the explicit self in method definitions has been > discussed to death and we all know it will stay. However, Guido > himself acknowledged that an alternative syntax makes perfect sense > and having both (

Re: Guido's new method definition idea

2008-12-06 Thread bearophileHUGS
Antoine De Groote: > Allowing "$" as a substitute for "self" wouldn't require this new syntax. > class C: > def method($, arg): > $.value = arg I think this (that is just sugar) may be a little better: class C: def method($, arg): $value = arg Or even this, combined with

Re: Guido's new method definition idea

2008-12-06 Thread Andreas Waldenburger
On 6 Dec 2008 09:18:20 GMT Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > On Sat, 06 Dec 2008 09:56:12 +0100, Antoine De Groote wrote: > > [snip reference to "preferably only one way to do it"] > > The reason why I'm against that change too. It adds a second, > alternative way to expres

Re: Guido's new method definition idea

2008-12-06 Thread Marc 'BlackJack' Rintsch
On Sat, 06 Dec 2008 09:56:12 +0100, Antoine De Groote wrote: > try this: > import this > > and look at the 15th line... The reason why I'm against that change too. It adds a second, alternative way to express something that is already in the language. > I agree that for newcomers to Pyt

Re: Guido's new method definition idea

2008-12-06 Thread Antoine De Groote
Allowing "$" as a substitute for "self" wouldn't require this new syntax. class C: def method($, arg): $.value = arg I'm strongly against this. This looks ugly and reminds me of Perl and Ruby. (I don't have anything against these languages, but there's a reason I use Python). Russ P

Re: Guido's new method definition idea

2008-12-06 Thread Antoine De Groote
try this: >>> import this and look at the 15th line... I agree that for newcomers to Python, the class method definition might seem strange. I certainly had problems with it when starting with Python, coming from Java. But in the meantime it feels right. I don't know if it is because I'm used to

Re: Guido's new method definition idea

2008-12-06 Thread James Stroud
Steven D'Aprano wrote: On Fri, 05 Dec 2008 20:35:07 -0800, James Stroud wrote: Daniel Fetchinson wrote: I'd like this new way of defining methods, what do you guys think? Consider the maverick who insists on class C: def me.method(arg): self.value = arg Replace "self" with "me".

Re: Guido's new method definition idea

2008-12-05 Thread Russ P.
On Dec 5, 6:21 pm, "Daniel Fetchinson" <[EMAIL PROTECTED]> wrote: > Hi folks, > > The story of the explicit self in method definitions has been > discussed to death and we all know it will stay. However, Guido > himself acknowledged that an alternative syntax makes perfect sense > and having both (

Re: Guido's new method definition idea

2008-12-05 Thread Kay Schluehr
On 6 Dez., 03:21, "Daniel Fetchinson" <[EMAIL PROTECTED]> wrote: > Hi folks, > > The story of the explicit self in method definitions has been > discussed to death and we all know it will stay. However, Guido > himself acknowledged that an alternative syntax makes perfect sense > and having both (o

Re: Guido's new method definition idea

2008-12-05 Thread Patrick Mullen
>> Daniel Fetchinson wrote: >>> http://neopythonic.blogspot.com/2008/10/why-explicit-self-has-to- > stay.html >>> >>> The proposal is to allow this: >>> >>> class C: >>> def self.method( arg ): >>> self.value = arg >>> return self.value >>> >>> instead of this: >>> >>> class C:

Re: Guido's new method definition idea

2008-12-05 Thread Steven D'Aprano
On Fri, 05 Dec 2008 20:35:07 -0800, James Stroud wrote: > Daniel Fetchinson wrote: >> http://neopythonic.blogspot.com/2008/10/why-explicit-self-has-to- stay.html >> >> The proposal is to allow this: >> >> class C: >> def self.method( arg ): >> self.value = arg >> return self.

Re: Guido's new method definition idea

2008-12-05 Thread James Stroud
Of course I meant class C: def me.method(arg): me.value = arg James -- http://mail.python.org/mailman/listinfo/python-list

Re: Guido's new method definition idea

2008-12-05 Thread James Stroud
Daniel Fetchinson wrote: http://neopythonic.blogspot.com/2008/10/why-explicit-self-has-to-stay.html The proposal is to allow this: class C: def self.method( arg ): self.value = arg return self.value instead of this: class C: def method( self, arg ): self.value