Re: Namespace hack

2012-06-05 Thread Daniel Fetchinson
>> Funny, you got to the last line of "import this" but apparently >> skipped the second line: >> >> Explicit is better than implicit. >> >> And you didn't even post your message on April 1 so no, I can't laugh >> even though I'd like to. > > Can you be less condescending? Of course! :) Anyway, t

Re: Namespace hack

2012-05-25 Thread Devin Jeanpierre
On Thu, May 24, 2012 at 9:04 AM, Daniel Fetchinson wrote: > Funny, you got to the last line of "import this" but apparently > skipped the second line: > > Explicit is better than implicit. > > And you didn't even post your message on April 1 so no, I can't laugh > even though I'd like to. Can you

Re: Namespace hack

2012-05-24 Thread Chris Angelico
On Fri, May 25, 2012 at 1:02 PM, Temia Eszteri wrote: > But then we've got "Simple is better than complex", and "Complex is > better than complicated". Of course if we decided to start iterating > through the zen of Python's verses and continually modifying the > example code to fit, it would get

Re: Namespace hack

2012-05-24 Thread Temia Eszteri
[Default] On 25 May 2012 02:47:11 GMT, Steven D'Aprano wrote: >Do you object to the ability to write standard Python modules? > ># module.py >def spam(obj, n): >return len(obj) + n > >def ham(obj): >return spam(obj, 23) > > >By your apparent misunderstanding of the Zen, you think that thi

Re: Namespace hack

2012-05-24 Thread Steven D'Aprano
Pardon me for breaking threading, but Daniel's response is not available on my ISP's news server, and I only discovered it by accident. On Thu May 24 15:04:34 CEST 2012, Daniel Fetchinson wrote: > > On Thu, 24 May 2012 08:50:59 +, Steven D'Aprano wrote: > > From the Zen of Python ("import t

Re: Namespace hack

2012-05-24 Thread Daniel Fetchinson
; class C: > x = 42 > def spam(self, y): > return self.x + y > def ham(self, z): > return self.spam(z+1) > > > Notice that the class attribute x is visible to the outside caller, but > methods spam and ham cannot see it except by prefixing it with a >

Namespace hack

2012-05-24 Thread Steven D'Aprano
return self.spam(z+1) Notice that the class attribute x is visible to the outside caller, but methods spam and ham cannot see it except by prefixing it with a reference to "self". Here's an example using my namespace hack example: @namespace def C(): # Abuse nested f