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

Nick Coghlan ncoghlan at gmail.com
Tue May 14 08:32:00 CEST 2013


On Tue, May 14, 2013 at 2:40 PM, Bruce Leban <bruce at leapyear.org> wrote:
>
> 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?

Good point.

Cheers,
Nick.

--
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia


More information about the Python-ideas mailing list