This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author leewz
Recipients barry, berker.peksag, eryksun, ethan.furman, jayvdb, leewz, martin.panter, r.david.murray, rhettinger
Date 2016-05-25.07:56:16
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
>>If @public were only to be used as a decorator, it would not be possible to
>>have `public` called on a function outside of its definition. But someone
>>might call `public(some_decorator(some_function))`.
>Do you mean, they'd call this is some module other than the one some_function
>was defined in?  I don't know that this is a use case we even want to support.

I mean they'd define their own function as a wrapped version of another function.

>That's true in a sense.  It doesn't change the decorated thing at all.  I
>think it's important to keep in mind that @public isn't the only way to add to

I mean more in that it acts in the scope of its caller, rather than its definition.

>You should get something like:
>AttributeError: 'tuple' object has no attribute 'append'
>which seems pretty obvious.

I don't think the C version shows a traceback, so it won't be clear that you're trying to assign to `__all__`.

When I rewrote `public` from memory, I wrote it something like this:
        except TypeError:
            module.__all__ = [*dunder_all, name]

>Well, consenting adults and all.  I'm not sure we need to protect ourselves so
>strictly against people who don't read the docs and don't understand Python
>(i.e. random cargo-culters).

Python is a popular learning language, and many will be students who haven't yet trained to reflexively look up docs. I saw the lack of such habits in Python's IRC channel.

"Consenting adults", I feel, is a reason to grant power: don't stop people from doing something they might need to do. But @public on a class method is just an error.
Date User Action Args
2016-05-25 07:56:17leewzsetrecipients: + leewz, barry, rhettinger, r.david.murray, ethan.furman, berker.peksag, martin.panter, eryksun, jayvdb
2016-05-25 07:56:17leewzsetmessageid: <>
2016-05-25 07:56:17leewzlinkissue26632 messages
2016-05-25 07:56:16leewzcreate