Chris,
Will we able to use late-bound arguments in dataclass when it’s creating the
__init__ function?
@dataclass
class C:
x: int
y: int
ls: list[int] => [x, y]
> On 10 Nov 2021, at 11:25 AM, Chris Angelico <[email protected]> wrote:
>
> On Wed, Nov 10, 2021 at 6:02 PM Christopher Barker <[email protected]
> <mailto:[email protected]>> wrote:
>>
>> On Mon, Nov 8, 2021 at 11:22 PM Rob Cliffe via Python-ideas
>> <[email protected]> wrote:
>>>
>>> I have more than once advocated
>>> x:=default
>>> (and there is no clash with the walrus operator, even if others have
>>> said/implied that there is).
>>
>>
>> not a clash, but you could have a walrus in the default expression, which
>> could be pretty visually confusing. On the other hand, maybe that's a really
>> bad idea anyway. And otherwise I like it.
>>
>
> BTW, there is one other small wrinkle with the := spelling, which is
> that it's very similar to annotation syntax:
>
> def spam(a:int=1): ...
> def ham(a:=1): ...
>
> Again, not a fundamental problem to the parser, since an empty
> expression isn't a valid annotation, but could be confusing.
>
> I don't think we're going to get away from that confusion. There are
> just too many things we want to do with the equals sign, and only so
> many keys on most people's keyboards.
>
> ChrisA
> _______________________________________________
> Python-ideas mailing list -- [email protected]
> <mailto:[email protected]>
> To unsubscribe send an email to [email protected]
> <mailto:[email protected]>
> https://mail.python.org/mailman3/lists/python-ideas.python.org/
> <https://mail.python.org/mailman3/lists/python-ideas.python.org/>
> Message archived at
> https://mail.python.org/archives/list/[email protected]/message/5WOGHMGGCKANNQA4RV53MS6PCVS2RIBN/
>
> <https://mail.python.org/archives/list/[email protected]/message/5WOGHMGGCKANNQA4RV53MS6PCVS2RIBN/>
> Code of Conduct: http://python.org/psf/codeofconduct/
> <http://python.org/psf/codeofconduct/>
_______________________________________________
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/L372DIZILNZBVG5QINWSOMVAO6UKJ7SS/
Code of Conduct: http://python.org/psf/codeofconduct/