Re: Python and static class methods

Jim Easterbrook <[email protected]> Thu, 4 Nov 2021 19:58:09 +0000
Newsgroups gmane.comp.programming.swig
Message-ID <[email protected]>
Hi William,

I've had a go at adding an option to do this, and submitted a PR.
https://github.com/swig/swig/pull/2093

Jim

On 20/10/2021 11:55, William S Fulton wrote:
> Hi Jim
> 
> There is no way to suppress the flattened method. I'd support a patch to 
> add this as an option though.
> 
> I've made the docs a bit clearer for now: 
> https://github.com/swig/swig/commit/7a65f028f88da6d5ba66602ddcccbce58b1a57ce 
> <https://github.com/swig/swig/commit/7a65f028f88da6d5ba66602ddcccbce58b1a57ce>.
> 
> William
> 
> On Fri, 24 Sept 2021 at 13:02, Jim Easterbrook 
> <[email protected] <mailto:[email protected]>> wrote:
> 
>     In the documentation
>     (http://www.swig.org/Doc4.0/Python.html#Python_nn20
>     <http://www.swig.org/Doc4.0/Python.html#Python_nn20>
>     ) it says "Prior to Python-2.2, Python classes had no support for
>     static
>     methods". The example it shows has several ways to access the static
>     member:
> 
>       >>> example.Spam_foo()    # Spam::foo()
>       >>> s = example.Spam()
>       >>> s.foo()               # Spam::foo() via an instance
>       >>> example.Spam.foo()    # Spam::foo(). Python-2.2 only
> 
>     Python 2.2 was a long time ago, and I'd like to exclude the
>     example.Spam_foo version from my Python interfaces. It's not needed and
>     isn't what users familiar with the C++ library being wrapped are
>     familiar with. (And the last line in the example should say "Python-2.2
>     onwards".)
> 
>     Is there a way to suppress the generation of example.Spam_foo?
>     -- 
>     Jim Easterbrook                 <http://www.jim-easterbrook.me.uk/
>     <http://www.jim-easterbrook.me.uk/>>
> 
> 
>     _______________________________________________
>     Swig-user mailing list
>     [email protected] <mailto:[email protected]>
>     https://lists.sourceforge.net/lists/listinfo/swig-user
>     <https://lists.sourceforge.net/lists/listinfo/swig-user>
> 


-- 
Jim Easterbrook                 <http://www.jim-easterbrook.me.uk/>


_______________________________________________
Swig-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/swig-user