~ubuntu-branches/ubuntu/maverick/swig1.3/maverick

« back to all changes in this revision

Viewing changes to Examples/python/overload_feature/example.i

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Landschoff
  • Date: 2002-03-29 01:56:07 UTC
  • Revision ID: james.westby@ubuntu.com-20020329015607-c0wt03xu8oy9ioj7
Tags: upstream-1.3.11
ImportĀ upstreamĀ versionĀ 1.3.11

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* File : example.i */
 
2
%module example
 
3
 
 
4
%{
 
5
#include "example.h"
 
6
%}
 
7
 
 
8
/* This example shows how to write an overloaded shadow function
 
9
   the behaves like C++.  We simply write the disambiguation code
 
10
   ourselves below using %feature */
 
11
 
 
12
%rename(bar_id) bar(int,double);
 
13
 
 
14
%feature("shadow") bar(int) {
 
15
def bar(*args):
 
16
    if len(args) == 3:
 
17
        return apply(examplec.Foo_bar_id,args)
 
18
    return apply(examplec.Foo_bar,args)
 
19
}
 
20
 
 
21
%include "example.h"
 
22
 
 
23
 
 
24
 
 
25
 
 
26
 
 
27
 
 
28