Hello, On Fri, 18 Dec 2020 17:42:26 +1300 Greg Ewing <[email protected]> wrote:
> On 18/12/20 1:48 pm, Paul Sokolovsky wrote: > > So, it's already clear that mod.func() syntax will continue to work > > as before. I don't foresee any problems with implementing that, do > > you? > > What about this: > > import random > > class A: > def choice(self, stuff): > return stuff[0] > > a = A() > > def f(x, y): > return x.choice(y) > > print(f(random, [1, 2])) > print(f(a, ["buckle", "my shoe"])) > > How much of this is allowed under your restricted semantics? It's fully allowed, under both part 1 and part 2 of the strict mode. It won't be possible to optimize it in any way under just the "strict mode" idea, but again, it will work. Generally, the idea behind the strict mode is to optimize *dynamic name lookups*. It doesn't deal with *dynamic typing* in any way (well, no more than optimizing dynamic lookups into static (in some, not all cases) would allow, and it does allow that). That's because: a) dynamic typing is what everybody loves about Python (myself including); b) there's already a way to deal with dynamic typing issue - type annotations; c) dealing with typing issues generally requires type inference, and general type inference is a task of quite different scale than the "strict mode" thingy I build here. (But adhoc type inference can be cheap, and again, the strict mode effectively enables type (and even value) inference for many interesting and practical cases.) > -- > Greg -- Best regards, Paul mailto:[email protected] _______________________________________________ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/[email protected]/message/B6KYXSTB634ZBJUL33WCLT2HY5IWU2NP/ Code of Conduct: http://python.org/psf/codeofconduct/
