Lazy Python usage (hack request)
June Kim
junaftnoon at nospamplzyahoo.com
Sat Dec 30 14:55:48 EST 2000
"Aahz Maruch" <aahz at panix.com> wrote :
[snip]
>
> 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?
Best regards,
June
More information about the Python-list
mailing list