splunk-sdk-python icon indicating copy to clipboard operation
splunk-sdk-python copied to clipboard

Using a reserved name

Open ansman opened this issue 15 years ago • 5 comments

list is a reserved keyword and should not be used for a method name.

Maybe use to_list? or items?

The affected methods are:

  • Collection#list
  • Inputs#list
  • Jobs#list

ansman avatar Nov 03 '11 17:11 ansman

Where is it noted that it is a reserved keyword? All the Python docs I can find don't have it (they have others).

itay avatar Nov 03 '11 18:11 itay

Pydev warns saying it is an assignment built-in symbol: list Maybe it's just wrong and think you're overwriting the list() function?

ansman avatar Nov 03 '11 19:11 ansman

Yeah, I'm unconvinced. It may very well change as we change our object model to something more descriptive, but I won't guarantee it.

itay avatar Nov 03 '11 19:11 itay

I am reluctant to make a breaking change for this one. We chose "list" because it is the term used by the REST API for the functionality. In retrospect we might have chosen a different term, but I don't think its worth a breaking change at this point.

This doesn't appear to do any actual harm other than confusing pylint and incorrectly color coding the method as a keyword in vi.

(leaving the issue open for now pending additional feedback).

blovering avatar Feb 27 '12 23:02 blovering

I have decided not to change this. Pylint complains, but the name does no harm and I dont want to take a breaking change for this and it the best mapping to the term used in the underlying REST API.

blovering avatar Mar 29 '12 04:03 blovering