[Python-ideas] Fwd: Define a method or function attribute outside of a class with the dot operator

Paul Moore p.f.moore at gmail.com
Fri Feb 10 06:32:15 EST 2017

On 10 February 2017 at 11:16, Chris Angelico <rosuav at gmail.com> wrote:
> On Fri, Feb 10, 2017 at 10:13 PM, Paul Moore <p.f.moore at gmail.com> wrote:
>> Furthermore, once we open up this possibility, I would expect requests
>> for things like
>>     func_table = {}
>>     func_table["foo"] = lambda a, b: a+b
>>     def func_table["bar"] (a,b):
>>         return a-b
>> pretty quickly. How would you respond to those? (Setting up function
>> tables is a much more common and reasonable need than monkeypatching
>> classes).
> Which is why these proposals always seem to gravitate to "anything you
> can assign to", which is at least easy enough to explain. All your
> examples would be completely acceptable.under that system.


More information about the Python-ideas mailing list