[Twisted-Python] Private positional argument API anti-pattern
exarkun at twistedmatrix.com
exarkun at twistedmatrix.com
Fri Jun 21 09:05:27 MDT 2013
Hello,
I've noticed there are a couple public APIs in Twisted now that accept a
"private" positional argument. I use scare quotes because I don't see
how it's actually possible to make a positional argument private.
Given a function defined like this:
def foo(_bar=None):
...
There is no indication that a use like this is problematic:
foo(3)
Perhaps the situation will be different with keyword-only arguments, but
for positional arguments I think it's unproductive and perhaps even
confusing to name arguments this way.
I suggest we fix the couple places where this has been done so far and
we avoid introducing any new instances.
FWIW, I found two examples of this in Twisted using:
$ grep -E '\W_reactor' twisted/ -r --include '*.py' | grep -E 'def\W'
Jean-Paul
More information about the Twisted-Python
mailing list