Lazy Python usage (hack request)
Aahz Maruch
aahz at panix.com
Sat Dec 30 22:47:05 EST 2000
In article <92lemh$5or$1 at news.nuri.net>,
June Kim <junaftnoon at nospamplzyahoo.com> wrote:
>"Aahz Maruch" <aahz at panix.com> wrote :
>>
>> Well, if you're going to stick to it not being an option to make any
>> changes, the answer is "no". However, you can make a little hack that
>> *does* work:
>>
>> >>> from lazy import lazy
>> >>> a = lazy.b
>> No name 'b' defined, using default 777
>> >>> print a
>> 777
>>
>> Inside lazy.py, you define a class called lazy with a __getitem__()
>> method.
>
>Shouldn't the method be __getattr__() instead?
Um, yeah. Sorry, my brain's a bit faded on this, the second-to-last day
of the first year of the 21st century.
--
--- Aahz (Copyright 2000 by aahz at pobox.com)
Androgynous poly kinky vanilla queer het <*> http://www.rahul.net/aahz/
Hugs and backrubs -- I break Rule 6
Ninth Virtual Anniversary: Tomorrow!
More information about the Python-list
mailing list