In any python API documentation, why are optional arguments written in a nested style?

This is just why do it:

find([spec=None[, fields=None[, skip=0[, limit=0[, timeout=True[, snapshot=False[, tailable=False[, sort=None[, max_scan=None[, as_class=None[, slave_okay=False[, await_data=False[, partial=False[, manipulate=True[, read_preference=ReadPreference.PRIMARY[, exhaust=False[, compile_re=True[, **kwargs]]]]]]]]]]]]]]]]]])

Which seems ugly and confusing, but appears in all the api docs I've ever come across, I may lack basic python knowledge.

+2
source share
2 answers

I do not have an authentic source to support my claim

Additional positional arguments presented in a nested style will ensure the correct ordering of the fields.

Example in os module for fdopen

os.fdopen(fd[, mode[, bufsize]])

Indicates that mode and bufsize are optional, but if you specify bufsize, you must also specify mode.

" ", , - inndicate, ,

, [re] split

split(string, maxsplit=0)
0

, Backus-Naur. Abhijit, ..

+2

Source: https://habr.com/ru/post/1620959/


All Articles