]> git.saurik.com Git - wxWidgets.git/blob - wxPython/SWIG/swig.python.patch.txt
added obsolescence note
[wxWidgets.git] / wxPython / SWIG / swig.python.patch.txt
1 This patch makes a number of changes to the SWIG python module.
2
3 1. Add -apply option, and change the default code output to use the
4 foo(*args, **kw) calling syntax instead of using apply(). If the
5 -apply option is given then code is generated as before. This is
6 very similar to Patch #737281 but the new -modern option makes the
7 second half of that patch unnecessary so it is not included here.
8
9 2. Add -new_repr option. This is the same as my Patch #797002 which I
10 will mark as closed since it is no longer needed. When this new
11 option is used then the __repr__ methods that are generated for
12 proxy classes will be more informative and give details about the
13 python class and the C++ class.
14
15 3. Add %feature("addtofunc"). It allows you to insert one or more
16 lines of code inside the shadow method or function that is already
17 generated, instead of replacing the whole thing like
18 %feature("shadow") does. For __init__ it goes at the end, for
19 __del__ it goes at the begining and for all others the code
20 generated is expanded out to be like
21
22 def Bar(*args, **kwargs):
23 val = _module.Foo_Bar(*args, **kwargs)
24 return val
25
26 and the "addtofunc" code is inserted just before the return
27 statement. If the feature is not used for a particular method or
28 function then the shorter code is generated just like before.
29
30 4. A little bit of refactoring to make implementing addtofunc a little
31 easier.
32
33 5. Added a -modern command-line flag that will cause SWIG to omit the
34 cruft in the proxy modules that allows it to work with versions of
35 Python prior to 2.2. The result is a simpler, cleaner and faster
36 python proxy module, but one that requires Python 2.2 or greater.
37 For most of us this requirement is easy to live with!
38
39
40 I've been using and greatly benefiting from all these features with
41 wxPython for the last few weeks and have had no problems.
42
43 This patch depends upon Patch #829317.