On Sun, Oct 24, 2021 at 3:26 AM Ethan Furman <et...@stoneleaf.us> wrote: > > On 10/23/21 9:07 AM, Chris Angelico wrote: > > > Proposal: Proper syntax and support for late-bound argument defaults. > > I like the proposal. > > > def spaminate(thing, count=:thing.getdefault()): > > ... > > > > def bisect(a, x, lo=0, hi=:len(a)): > > if lo < 0: > > raise ValueError('lo must be non-negative') > > But not the color -- I see "=:" too easily confused with ":=". However, I do > like: >
(Truncated email, I presume) Yeah, I'm not wedded to the precise syntax. But it needs to be simple and easy to read, it needs to not be ugly, and it needs to not be valid syntax already. There are a few alternatives, but I like them even less: def bisect(a, x, lo=0, hi=@len(a)): def bisect(a, x, lo=0, hi=?len(a)): def bisect(a, x, lo=0, hi=>len(a)): def bisect(a, x, lo=0, hi=\len(a)): def bisect(a, x, lo=0, hi=`len(a)`): def bisect(a, x, lo=0, hi!=len(a)): Feel free to propose an improvement to the syntax. Whatever spelling is ultimately used, this would still be of value. ChrisA _______________________________________________ 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/VI566NWZT3OKE6HWRF3BJXODLV2ACODR/ Code of Conduct: http://python.org/psf/codeofconduct/