﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
32794	Get rid of boolean traps in Engine	Abhyudai	nobody	"While working on adding `repr` method to the `django.template.engine.Engine` class, I noticed the class definition, (essentially the `__init__` function) accepts some parameters like `app_dirs`, `debug` and `autoescape` which are `boolean` but are accepted as positional arguments. I think this design pattern pretty much falls into the real of [https://ariya.io/2011/08/hall-of-api-shame-boolean-trap boolean-trap].

One of the ways that we can deal by not making this backward incompatible would be to add `**kwargs` to the function definition and do something of this type along the lines:

{{{#!python
def __init__(self, dirs=None, app_dirs=False, context_processors=None,
                 debug=False, loaders=None, string_if_invalid='',
                 file_charset='utf-8', libraries=None, builtins=None, autoescape=True, /, **kwargs):
     # because False is it's default value
     if not debug and 'debug' not in kwargs:
         raise DeprecationWarning('this argument will be made named only in a later release')
    
     # the same thing can be done with the other two arguments
}}}

Another way would be to fiddle with `inspect.signature`.  While the first one appears lesser complex to me, I'm open to any other suggestions.

If the proposal seems acceptable, I would want to work on it."	Cleanup/optimization	closed	Template system	3.2	Normal	wontfix	template, engine		Unreviewed	0	0	0	0	0	0
