Re: Method / Functions - What are the differences?

2010-03-21 Thread Aahz
In article mailman.555.1268232321.23598.python-l...@python.org, John Posner jjpos...@optimum.net wrote: Bruno (and anyone else interested) -- As I promised/threatened, here's the *start* of a write-up on properties, aimed at non-advanced Python programmers:

Re: Method / Functions - What are the differences?

2010-03-21 Thread Steve Holden
Aahz wrote: In article mailman.555.1268232321.23598.python-l...@python.org, John Posner jjpos...@optimum.net wrote: Bruno (and anyone else interested) -- As I promised/threatened, here's the *start* of a write-up on properties, aimed at non-advanced Python programmers:

Re: Method / Functions - What are the differences?

2010-03-21 Thread John Bokma
a...@pythoncraft.com (Aahz) writes: In article mailman.555.1268232321.23598.python-l...@python.org, John Posner jjpos...@optimum.net wrote: Bruno (and anyone else interested) -- As I promised/threatened, here's the *start* of a write-up on properties, aimed at non-advanced Python

Re: Method / Functions - What are the differences?

2010-03-21 Thread John Posner
On 3/21/2010 5:34 PM, Aahz wrote: In articlemailman.555.1268232321.23598.python-l...@python.org, John Posnerjjpos...@optimum.net wrote: Bruno (and anyone else interested) -- As I promised/threatened, here's the *start* of a write-up on properties, aimed at non-advanced Python programmers:

Re: Method / Functions - What are the differences?

2010-03-18 Thread John Posner
On 3/10/2010 8:37 PM, Gabriel Genellina wrote: En Wed, 10 Mar 2010 11:45:38 -0300, John Posner jjpos...@optimum.net escribió: As I promised/threatened, here's the *start* of a write-up on properties, aimed at non-advanced Python programmers:

Re: Method / Functions - What are the differences?

2010-03-10 Thread John Posner
[ cross-posting to edu-sig ] Bruno (and anyone else interested) -- As I promised/threatened, here's the *start* of a write-up on properties, aimed at non-advanced Python programmers: http://www.jjposner.net/media/python-properties-0310.pdf I'm interested in corrections, of course. But I'm

Re: [Edu-sig] Method / Functions - What are the differences?

2010-03-10 Thread Edward Cherlin
On Wed, Mar 10, 2010 at 09:45, John Posner jjpos...@optimum.net wrote: [ cross-posting to edu-sig ] Bruno (and anyone else interested) -- As I promised/threatened, here's the *start* of a write-up on properties, aimed at non-advanced Python programmers:  

Re: Method / Functions - What are the differences?

2010-03-10 Thread Gabriel Genellina
En Wed, 10 Mar 2010 11:45:38 -0300, John Posner jjpos...@optimum.net escribió: As I promised/threatened, here's the *start* of a write-up on properties, aimed at non-advanced Python programmers: http://www.jjposner.net/media/python-properties-0310.pdf I'd use 'function' instead of

Re: Method / Functions - What are the differences?

2010-03-05 Thread Bruno Desthuilliers
John Posner a écrit : On 3/3/2010 6:56 PM, John Posner wrote: ... I was thinking today about doing a Bruno, and producing similar pieces on: * properties created with the @property decorator * the descriptor protocol I'll try to produce something over the next couple of days. Starting to

Re: Method / Functions - What are the differences?

2010-03-05 Thread John Posner
On 3/5/2010 7:15 AM, Bruno Desthuilliers wrote: John Posner a écrit : On 3/3/2010 6:56 PM, John Posner wrote: ... I was thinking today about doing a Bruno, and producing similar pieces on: * properties created with the @property decorator * the descriptor protocol I'll try to produce

Re: Method / Functions - What are the differences?

2010-03-04 Thread Bruno Desthuilliers
Eike Welk a écrit : Bruno Desthuilliers wrote: John Posner a écrit : Done -- see http://wiki.python.org/moin/FromFunctionToMethod Done and well done !-) Thanks again for the good job John. I like it too, thanks to both of you! I have two small ideas for improvement: - Swap the first two

Re: Method / Functions - What are the differences?

2010-03-04 Thread John Posner
On 3/4/2010 5:59 AM, Bruno Desthuilliers wrote: I have two small ideas for improvement: - Swap the first two paragraphs. First say what it is, and then give the motivation. Mmm... As far as I'm concerned, I like it the way its. John ? I think it doesn't make very much difference. But in the

Re: Method / Functions - What are the differences?

2010-03-04 Thread John Posner
On 3/3/2010 6:56 PM, John Posner wrote: ... I was thinking today about doing a Bruno, and producing similar pieces on: * properties created with the @property decorator * the descriptor protocol I'll try to produce something over the next couple of days. Starting to think about a writeup

Re: Method / Functions - What are the differences?

2010-03-03 Thread Bruno Desthuilliers
Eike Welk a écrit : John Posner wrote: I've updated the text at this location: http://cl1p.net/bruno_0301.rst/ I think this is a very useful writeup! It would be perfect with a little bit of introduction that says: 1. - What it is: The rough details of method look-up; 2. - which

Re: Method / Functions - What are the differences?

2010-03-03 Thread John Posner
On 3/3/2010 5:56 AM, Bruno Desthuilliers wrote: Eike Welk a écrit : John Posner wrote: I've updated the text at this location: http://cl1p.net/bruno_0301.rst/ I think this is a very useful writeup! It would be perfect with a little bit of introduction that says: 1. - What it is: The rough

Re: Method / Functions - What are the differences?

2010-03-03 Thread Bruno Desthuilliers
John Posner a écrit : On 3/3/2010 5:56 AM, Bruno Desthuilliers wrote: Eike Welk a écrit : John Posner wrote: I've updated the text at this location: http://cl1p.net/bruno_0301.rst/ I think this is a very useful writeup! It would be perfect with a little bit of introduction that says: 1. -

Re: Method / Functions - What are the differences?

2010-03-03 Thread John Posner
On 3/3/2010 9:58 AM, John Posner wrote: Film at 11, John Done -- see http://wiki.python.org/moin/FromFunctionToMethod -John -- http://mail.python.org/mailman/listinfo/python-list

Re: Method / Functions - What are the differences?

2010-03-03 Thread John Posner
On 3/3/2010 10:48 AM, Bruno Desthuilliers wrote: I spotted this: http://www.python.org/doc/faq/programming/#what-is-a-method http://www.python.org/doc/faq/general/#why-must-self-be-used-explicitly-in-method-definitions-and-calls Our text is probably a bit too long for a direct inclusion in

Re: Method / Functions - What are the differences?

2010-03-03 Thread Bruno Desthuilliers
John Posner a écrit : On 3/3/2010 9:58 AM, John Posner wrote: Film at 11, John Done -- see http://wiki.python.org/moin/FromFunctionToMethod Done and well done !-) Thanks again for the good job John. PS : Do you think it could be possible to add link to this page from the relevant FAQ

Re: Method / Functions - What are the differences?

2010-03-03 Thread Eike Welk
Bruno Desthuilliers wrote: John Posner a écrit : Done -- see http://wiki.python.org/moin/FromFunctionToMethod Done and well done !-) Thanks again for the good job John. I like it too, thanks to both of you! I have two small ideas for improvement: - Swap the first two paragraphs. First say

Re: Method / Functions - What are the differences?

2010-03-03 Thread John Posner
On 3/3/2010 6:33 PM, Eike Welk wrote: I have two small ideas for improvement: - Swap the first two paragraphs. First say what it is, and then give the motivation. No problem -- since this is a Wiki, you can perform the swap yourself! (If you haven't done it in a day or so, I'll do the deed.)

Re: Method / Functions - What are the differences?

2010-03-02 Thread Bruno Desthuilliers
John Posner a écrit : On 3/1/2010 2:59 PM, Bruno Desthuilliers wrote: Answer here: http://groups.google.com/group/comp.lang.python/tree/browse_frm/thread/bd71264b6022765c/3a77541bf9d6617d#doc_89d608d0854dada0 I really have to put this in the wiki :-/ Bruno, I performed a light

Re: Method / Functions - What are the differences?

2010-03-02 Thread John Posner
On 3/2/2010 3:57 AM, Bruno Desthuilliers wrote: With the instance object (if any) and class object available, it's easy to create a method object that wraps the function object. That's perfect. Fixed. But there's also a typo to fix in the Python implementation of the Method object: in

Re: Method / Functions - What are the differences?

2010-03-02 Thread Eike Welk
John Posner wrote: I've updated the text at this location: http://cl1p.net/bruno_0301.rst/ I think this is a very useful writeup! It would be perfect with a little bit of introduction that says: 1. - What it is: The rough details of method look-up; 2. - which contains some of the

Re: Method / Functions - What are the differences?

2010-03-01 Thread Bruno Desthuilliers
Michael Rudolf a écrit : Out of curiosity I tried this and it actually worked as expected: class T(object): x=[] foo=x.append def f(self): return self.x t=T() t.f() [] T.foo(1) t.f() [1] At first I thought hehe, always fun to play around with python.

Re: Method / Functions - What are the differences?

2010-03-01 Thread John Posner
On 3/1/2010 2:59 PM, Bruno Desthuilliers wrote: Answer here: http://groups.google.com/group/comp.lang.python/tree/browse_frm/thread/bd71264b6022765c/3a77541bf9d6617d#doc_89d608d0854dada0 I really have to put this in the wiki :-/ Bruno, I performed a light copy-edit of your writeup and put

Method / Functions - What are the differences?

2010-02-28 Thread Michael Rudolf
Out of curiosity I tried this and it actually worked as expected: class T(object): x=[] foo=x.append def f(self): return self.x t=T() t.f() [] T.foo(1) t.f() [1] At first I thought hehe, always fun to play around with python. Might be

Re: Method / Functions - What are the differences?

2010-02-28 Thread Alf P. Steinbach
* Michael Rudolf: Out of curiosity I tried this and it actually worked as expected: class T(object): x=[] foo=x.append def f(self): return self.x t=T() t.f() [] T.foo(1) t.f() [1] At first I thought hehe, always fun to play around with python. Might be

Re: Method / Functions - What are the differences?

2010-02-28 Thread Rob Williscroft
Michael Rudolf wrote in news:hmdo3m$28...@news.urz.uni-heidelberg.de in comp.lang.python: Note that all I did was moving the list and foo into the instance. Still no self and no cls, but also no static behaviour any more. Yes in the first case foo was an attribute of the class, and in the

Re: Method / Functions - What are the differences?

2010-02-28 Thread Michael Rudolf
Am 28.02.2010 15:08, schrieb Alf P. Steinbach: Hello.upper built-in method upper of str object at 0x00BA16E0 f = Hello.upper f built-in method upper of str object at 0x00BA16E0 f() 'HELLO' f.__self__ 'Hello' Holy hand grenade. You have no Idea how enlightened I feel right