From 3ed34dd3ffe5ff6ff0e19cfd047a138b431232a3 Mon Sep 17 00:00:00 2001 From: Jose Date: Tue, 24 Jan 2017 12:02:27 +0100 Subject: Python minor simplifications - Replace statimethod function with staticmethod anotations - Simplify version comparison in Python35 --- cpp/src/Slice/PythonUtil.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'cpp/src/Slice/PythonUtil.cpp') diff --git a/cpp/src/Slice/PythonUtil.cpp b/cpp/src/Slice/PythonUtil.cpp index 18428211e97..e1001869e8a 100644 --- a/cpp/src/Slice/PythonUtil.cpp +++ b/cpp/src/Slice/PythonUtil.cpp @@ -569,11 +569,11 @@ Slice::Python::CodeVisitor::visitClassDefStart(const ClassDefPtr& p) // // ice_staticId // - _out << sp << nl << "def ice_staticId():"; + _out << sp << nl << "@staticmethod"; + _out << nl << "def ice_staticId():"; _out.inc(); _out << nl << "return '" << scoped << "'"; _out.dec(); - _out << nl << "ice_staticId = staticmethod(ice_staticId)"; } if(!ops.empty()) @@ -761,27 +761,27 @@ Slice::Python::CodeVisitor::visitClassDefStart(const ClassDefPtr& p) _out.dec(); } - _out << sp << nl << "def checkedCast(proxy, facetOrContext=None, context=None):"; + _out << sp << nl << "@staticmethod"; + _out << nl << "def checkedCast(proxy, facetOrContext=None, context=None):"; _out.inc(); _out << nl << "return _M_" << prxAbs << ".ice_checkedCast(proxy, '" << scoped << "', facetOrContext, context)"; _out.dec(); - _out << nl << "checkedCast = staticmethod(checkedCast)"; - _out << sp << nl << "def uncheckedCast(proxy, facet=None):"; + _out << sp << nl << "@staticmethod"; + _out << nl << "def uncheckedCast(proxy, facet=None):"; _out.inc(); _out << nl << "return _M_" << prxAbs << ".ice_uncheckedCast(proxy, facet)"; _out.dec(); - _out << nl << "uncheckedCast = staticmethod(uncheckedCast)"; // // ice_staticId // - _out << sp << nl << "def ice_staticId():"; + _out << sp << nl << "@staticmethod"; + _out << nl << "def ice_staticId():"; _out.inc(); _out << nl << "return '" << scoped << "'"; _out.dec(); - _out << nl << "ice_staticId = staticmethod(ice_staticId)"; _out.dec(); -- cgit v1.2.3