What happened in this class

Emile van Sebille emile at fenx.com
Sun Dec 31 06:31:25 CET 2000


I saw Pearu's lazy extension and built and installed it on
my linux system(recent cvs).  I thought I'd see how it
played in a class vs getattr and got this result.  Thinking
something broke along the way, I then switched over to the
win95 system(2.0 #8), and got the same thing.  This doesn't
happen under 1.52.


class test:
    def __getattr__(self, name):
        return "egs"

t = test()
print dir(t)[1:5]

['e', 'g', 'g', 's']


Now I know this is contrived, but I still didn't expect
these results.  Should I have?

--

Emile van Sebille
emile at fenx.com
-------------------







More information about the Python-list mailing list