Given that @dataclass is a decorator, and otherwise you're just defining a class, some concerns:
1. Such proposed syntax would require a change to the language specification. 2. It would seem that / and * in a class not decorated with @dataclass would be of no other utility. Paul On Thu, 2021-03-11 at 10:08 -0500, Ricky Teachey wrote: > On Thu, Mar 11, 2021 at 10:00 AM Ethan Furman <et...@stoneleaf.us> > wrote: > > On 3/11/21 4:20 AM, Ricky Teachey wrote: > > > > > This might be a bit of an extreme step to take, but has new > > syntax for this ever been discussed? Here I am using the same > > indicator for keyword arguments as in a function signature, hanging > > on a line by itself: > > > > > ... > > > @dataclasses.dataclass > > > class Comparator: > > > / # args become positional after this line > > > a: Any > > > b: Any > > > * # args become kwd args after this line > > > key: Optional[Callable[whatever]] = None > > > > Actually, the '/' indicates that names /before/ it are positional > > only. > > > > -- > > ~Ethan~ > > > > > Yes you're of course correct! Sorry! > > So the corrected version would be: > > @dataclasses.dataclass > class Comparator: > a: Any > b: Any > / # args before this line positional only > * # args become kwd args after this line > key: Optional[Callable[whatever]] = None > > --- > Ricky. > > "I've never met a Kentucky man who wasn't either thinking about going > home or actually going home." - Happy Chandler > > > _______________________________________________ > Python-ideas mailing list -- python-ideas@python.org > To unsubscribe send an email to python-ideas-le...@python.org > https://mail.python.org/mailman3/lists/python-ideas.python.org/ > Message archived at > https://mail.python.org/archives/list/python-ideas@python.org/message/L6Y5C7CFPEQECK5OWVOI4CKAYGHBHAPM/ > Code of Conduct: http://python.org/psf/codeofconduct/
_______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/FJDZ4TDKDSERY5P6F4CU777QC5IEEKHW/ Code of Conduct: http://python.org/psf/codeofconduct/