Re: Python and static class methods

William S Fulton <[email protected]> Wed, 20 Oct 2021 11:55:02 +0100
Newsgroups gmane.comp.programming.swig
Message-ID <CANGqftAP39z0ORLgzJgY7DoTi+j7J+qeRTppgnoP8p_Hqya0kA@mail.gmail.com>
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
.

William

On Fri, 24 Sept 2021 at 13:02, Jim Easterbrook <[email protected]>
wrote:

> In the documentation (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/>
>
>
> _______________________________________________
> Swig-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/swig-user
>

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