diff options
author | Jose <jose@zeroc.com> | 2017-01-24 12:02:27 +0100 |
---|---|---|
committer | Jose <jose@zeroc.com> | 2017-01-24 12:02:27 +0100 |
commit | 3ed34dd3ffe5ff6ff0e19cfd047a138b431232a3 (patch) | |
tree | 258c4bf0a630109a6f18136a515015538479f95f /cpp/src/Slice/PythonUtil.cpp | |
parent | PHP: Do not generate proxy types for class less operations (diff) | |
download | ice-3ed34dd3ffe5ff6ff0e19cfd047a138b431232a3.tar.bz2 ice-3ed34dd3ffe5ff6ff0e19cfd047a138b431232a3.tar.xz ice-3ed34dd3ffe5ff6ff0e19cfd047a138b431232a3.zip |
Python minor simplifications
- Replace statimethod function with staticmethod anotations
- Simplify version comparison in Python35
Diffstat (limited to 'cpp/src/Slice/PythonUtil.cpp')
-rw-r--r-- | cpp/src/Slice/PythonUtil.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
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(); |