Hi!

Another question related with http://trac.sagemath.org/sage_trac/ticket/6854

Reading the documentation of "dir", I expected
"""
...
    If the object supplies a method named __dir__, it will be used;
otherwise
    the default dir() logic is used and returns:
...
"""

But in fact, __dir__ is ignored:
{{{
sage: class FOO:
....:     def __init__(self,x):
....:         self.x = x
....:     def __dir__(self):
....:         return dir(self.x)
....:
sage: foo = FOO(x)
sage: dir(foo)
['__dir__', '__doc__', '__init__', '__module__', 'x']
sage: dir(foo.x)

['Order',
 '__abs__',
 '__add__',
 '__call__',
 '__class__',
 '__cmp__',
 '__complex__',
 '__delattr__',
 '__div__',
 '__doc__',
 '__eq__',
 '__float__',
 '__format__',
 '__ge__',
 '__getattribute__',
...
}}}

Is it an error in the Python documentation, or is it a Sage "feature"?

Cheers,
Simon

-- 
To post to this group, send an email to [email protected]
To unsubscribe from this group, send an email to 
[email protected]
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to