On Fri, Apr 17, 2020 at 6:09 PM David Mertz <me...@gnosis.cx> wrote: > On Fri, Apr 17, 2020 at 9:57 AM <oliveira.rodrig...@gmail.com> wrote: > >> The mode-switch proposal though would not impede one to mix shorthand and >> longhand forms. This should be valid syntax: >> >> ```python >> return render_template("index.html", *, >> twitter, username=user["display_name"], >> channel, channelid, error, >> setups=database.list_setups(channelid), >> sched_tz, schedule, sched_tweet, >> checklist=database.get_checklist(channelid), >> timers=database.list_timers(channelid), >> tweets, >> ) >> ``` >> > > I definitely hate the above version. Intermixing auto-named values with > bound values is super-confusing and a huge bug magnet. >
How is it confusing? How is it a bug magnet? I do think that example looks like a mess, but if each parameter is on its own line, I think it looks fine: ``` render_template( "index.html", *, twitter, username=user["display_name"], channel, channelid, error, setups=database.list_setups(channelid), sched_tz, schedule, sched_tweet, checklist=database.get_checklist(channelid), timers=database.list_timers(channelid), tweets, ) ``` > However, the following does not look bad ONLY if the mode-switch is > strictly to bare-names-only after the switch: > > render_template("index.html", > username=user["display_name"], > setups=database.list_setups(channelid), > checklist=database.get_checklist(channelid), > timers=database.list_timers(channelid), > **, > twitter, > channel, > channelid, > error, > sched_tz, > schedule, > sched_tweet, > tweets, > **more_kwargs) > > Putting the named parameters strictly first gives a hint to the fact that > the rest are "special named parameters" (with auto-naming). > Why does that need emphasising? Are you thinking like Ricky and Steven D'Aprano that people might sometimes think that they're looking at positional arguments and get confused?
_______________________________________________ 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/RJJS22VYMIXAZCTACMOI2MKKUI5ODZSN/ Code of Conduct: http://python.org/psf/codeofconduct/