Am Montag, 7. April 2014 23:36:01 UTC+2 schrieb Andrey Novoseltsev: > Hello, > > I am trying to deprecate a function with an alias which seems to be very > straightforward: > http://git.sagemath.org/sage.git/commit/?id=2080f3cf0365f4b568ce1129f3d0dc448fe80f11 > but it results in the following error - what am I doing wrong? > > Thank you! > Andrey > > > sage: lattice_polytope.cross_polytope(3) > 3-d reflexive polytope in 3-d lattice M > sage: lattice_polytope.octahedron(3) > --------------------------------------------------------------------------- > AttributeError Traceback (most recent call last) > <ipython-input-2-927555e2c35c> in <module>() > ----> 1 lattice_polytope.octahedron(Integer(3)) > > /home/novoselt/sage.git/local/lib/python2.7/site-packages/sage/misc/superseded.pyc > in __call__(self, *args, **kwds) > 203 > 204 deprecation(self.trac_number, > --> 205 "%s is deprecated. Please use %s > instead."%(self.__name__, other)) > 206 if self.instance is None: > 207 return self.func(*args, **kwds) > > /home/novoselt/sage.git/local/lib/python2.7/site-packages/sage/misc/lazy_attribute.so > in sage.misc.lazy_attribute._lazy_attribute.__get__ > (sage/misc/lazy_attribute.c:1357)() > > /home/novoselt/sage.git/local/lib/python2.7/site-packages/sage/misc/superseded.pyc > in __name__(self) > 183 if val is self: > 184 return key > --> 185 raise AttributeError, "The name of this deprecated function > can not be determined" > 186 > 187 def __call__(self, *args, **kwds): > > AttributeError: The name of this deprecated function can not be determined
Hi Andrey, I know too little about python internals to know how to fix this, but the problem appears to be that __name__ cannot find the variable name of lattice_polytope.octahedron because it has not been imported into the global namespace. If you try something like sage: from sage.geometry.lattice_polytope import octahedron sage: octahedron(3) then it does work. So it seems that __name__ is not looking in all the necessary places. Because it cannot find lattice_polytope.octahedron, there are some other things that don't work the way one might want them to. For example sage: o = lattice_polytope.octahedron sage: lattice_polytope.octahedron(3) /home/pcl337b/jkeitel/sage/sage/src/bin/sage-ipython:1: DeprecationWarning: o is deprecated. Please use sage.geometry.lattice_polytope.cross_polytope instead. See http://trac.sagemath.org/15240 for details. #!/usr/bin/env python A lattice polytope: 3-dimensional, 6 vertices. So is there a way to know which variables from other source files have been used? Best, Jan -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.