Is it possible to format the list without * Magic?

I wrote Python code that works, but Pilint does not like a star. He continues to tell me:

Used * or ** magic (star-args) 

Can I write my code without a star? Some information: I use lxml ; self.xml is an objectified XML file.

 @property def version_string(self): '''Return the version as a string.''' try: version_format = self.xml.version.get("format") except AttributeError: return None version_values = (v.text for v in self.xml.version.v) return version_format.format(*version_values) 
+7
python pylint
source share
3 answers

There is nothing wrong with a splat statement. Not knowing what the version_format function does, you cannot say whether you can pass the iterable, or iterate over the function directly, but frankly, there is no reason for this.

+11
source share

If you do not like this pylint warning, disable it. He was originally introduced because he had a lot

 def some_function(*args, **kwargs): pass 

reduces readability / maintainability of the code.

+7
source share

star-args (W0142) is no longer present in pylint (at least since version 1.4.3). Apparently, it was deleted quite recently.

+4
source share

All Articles