-*ε*
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
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):
>>
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
[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
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
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
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
[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
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
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):
> -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
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
[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
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
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
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):
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
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
>
> 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
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
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
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?
>
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,
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
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
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."
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
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
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
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
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
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
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
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
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
>>> 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
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
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
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
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
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
>>
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
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
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 (
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]
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
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
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
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
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
> 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
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?
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
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
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 *
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
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
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
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
>> 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
> 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
>> 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
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 (
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
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
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
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
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
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
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
Bad idea having two ways to do this. Pick one or the other!
--
http://mail.python.org/mailman/listinfo/python-list
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.
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:
> >> >
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
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
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 $,
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 =
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
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
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 (
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
"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
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
[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):
>
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'
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
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 (
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
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
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
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
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
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".
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 (
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
>> 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:
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.
Of course I meant
class C:
def me.method(arg):
me.value = arg
James
--
http://mail.python.org/mailman/listinfo/python-list
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
99 matches
Mail list logo