cosmetic for generated python code
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8850 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
28e84adf61
commit
a66fa50a8c
4 changed files with 10 additions and 30 deletions
|
|
@ -120,10 +120,9 @@
|
|||
|
||||
%define %swig_pair_methods(pair...)
|
||||
%extend {
|
||||
%pythoncode {
|
||||
def __len__(self):
|
||||
return 2
|
||||
def __getitem__(self, index):
|
||||
%pythoncode {def __len__(self): return 2
|
||||
def __repr__(self): return str((self.first, self.second))
|
||||
def __getitem__(self, index):
|
||||
if not (index % 2):
|
||||
return self.first
|
||||
else:
|
||||
|
|
@ -132,13 +131,9 @@ def __setitem__(self, index, val):
|
|||
if not (index % 2):
|
||||
self.first = val
|
||||
else:
|
||||
self.second = val
|
||||
def __repr__(self):
|
||||
return str((self.first, self.second))
|
||||
}
|
||||
self.second = val}
|
||||
}
|
||||
%enddef
|
||||
|
||||
|
||||
%include <std/std_pair.i>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue