Re: Default annotations for variables

2017-12-27 Thread INADA Naoki
typing's primary intention is "static" typing with tools like mypy. Introspection is not primary usage. Adding such information for every class, module, etc makes Python slower and fatter. But I want to make Python more swift and slim. INADA Naoki On Wed, Dec 27, 2017

Re: Default annotations for variables

2017-12-27 Thread Kirill Balunov
2017-12-27 14:19 GMT+03:00 Kirill Balunov : > Here I was a bit knocked down by the IPython console. Strangely, but the ` > __annotations__` is not initialized to a an empty dict when you start it, > while in Python console it is. > In addition, there are some imbalance

Re: Default annotations for variables

2017-12-27 Thread Kirill Balunov
2017-12-27 13:54 GMT+03:00 Chris Angelico : > This won't work. When you say "a.__type__", it means "take the *value* > referenced by a, and look up its __type__ attribute". So it's > equivalent to writing: > > (11).__type__ > (12).__type__ > Thank you for clarification, I

Re: Default annotations for variables

2017-12-27 Thread Chris Angelico
On Wed, Dec 27, 2017 at 9:41 PM, Kirill Balunov wrote: > Will there be any implications (or is it possible) if all variables will > have an attribute *something like* `__type__` which by default will be > initialized to *something like* `AnyType`. So in the case `x = 12`

Default annotations for variables

2017-12-27 Thread Kirill Balunov
Will there be any implications (or is it possible) if all variables will have an attribute *something like* `__type__` which by default will be initialized to *something like* `AnyType`. So in the case `x = 12` will be equivalent to `x: AnyType = 12`. x: int x = 12 x.__type__ # int a, b = 11, 12