[Python-ideas] Syntax for easy binding __name__, __module__, __qualname__ to arbitrary objects

Bruce Leban bruce at leapyear.org
Tue May 14 06:40:36 CEST 2013


On Mon, May 13, 2013 at 8:49 PM, Nick Coghlan <ncoghlan at gmail.com> wrote:

> What Piotr's proposal crystalised for me is the idea that we really
> have two different kinds of name binding in Python. I'm going to call
> them "incidental binding" and "definitive binding".
> ...
>

Nice and clear explanation.


>     if hasattr(_ref, "__defname__"):
> ...
>


> The beauty of this syntax is that it means if we define __defname__
> appropriately on function objects and on type, then ...
>

Why make __defname__ optional? If the author explicitly sticks a def in
front of an assignment when they shouldn't, I think that should be an
error. Do you really want:

def a = 3


to be allowed?

--- Bruce
Latest blog post: Alice's Puzzle Page http://www.vroospeak.com
Learn how hackers think: http://j.mp/gruyere-security
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20130513/e43caeaf/attachment.html>


More information about the Python-ideas mailing list