[Python-Dev] Re: RFC on Callable Syntax PEP

2021-12-21 Thread Gregory Beauregard via Python-Dev
Ahah, that makes sense. But then I think I buy into your reasoning that this 
isn't really a replacement for callable syntax (although functions as types 
opens up other interesting possibilities). For this and other reasons I'd hate 
to see callable syntax rejected in favor of it, so definite +1 on new callable 
syntax for me.

p.s. I'm +0.5 on | binding tighter than ->
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/ZURCWPSOE72MFPWONUIOH3XWVJ6ETWR5/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-Dev] Re: RFC on Callable Syntax PEP

2021-12-20 Thread Gregory Beauregard via Python-Dev
Does `lambda b: 3` type check with `IntToIntFunc` or only `lambda a: 3`? The 
intent seems to be it's more like `Callable` (where the argument name is not 
important), but maybe both could be supported? I wonder about making more use 
of the `_` soft keyword where calling a function with multiple `_` is a runtime 
error. Maybe it would make too much of a mess.

After some testing evidently mypy only applies its knowledge sometimes anyway: 
https://github.com/python/mypy/issues/11807
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/MDR2TCLEN7YKNUHKID5D6KMBJL73UBOZ/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-Dev] We should accept Final as indicating ClassVar for dataclasses

2021-10-08 Thread Gregory Beauregard via Python-Dev
(copied from typing on advice since this affects runtime behavior)
PEP 591 for Final states "Type checkers should infer a final attribute that is 
initialized in a class body as being a class variable. Variables should not be 
annotated with both ClassVar and Final."

ClassVar is used to indicate library behavior in dataclasses. Therefore, I 
propose accepting the Final attribute as an indicator of a ClassVar in 
dataclass class bodies in order to be better compatible with the Final PEP.

One edge case that would need to be handled is when someone might explicitly 
mark a dataclass field Final:
a: Final[int] = dataclasses.field(init=False, default=10)

I've opened an issue as well and would greatly appreciate any feedback: 
https://bugs.python.org/issue45384

I appreciate your time,
Gregory Beauregard
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/HS2UEMTQJYPHXOI6FPU523JMCCHHRNGH/
Code of Conduct: http://python.org/psf/codeofconduct/