How to break the following line of python
I have come upon a couple of lines of code similar to this one, but I'm unsure how I should break it:
blueprint = Blueprint(self.blueprint_map[str(self.ui.blueprint_combo.currentText())], runs=self.ui.runs_spin.text(), me=self.ui.me_spin.text(), pe=self.ui.pe_skill_combo.currentIndex())
Thanks in advanc开发者_StackOverflow社区e
blueprint = Blueprint(
self.blueprint_map[str(self.ui.blueprint_combo.currentText())],
runs=self.ui.runs_spin.text(),
me=self.ui.me_spin.text(),
pe=self.ui.pe_skill_combo.currentIndex(),
)
How about this
blueprint_item = self.blueprint_map[str(self.ui.blueprint_combo.currentText())]
blueprint = Blueprint(blueprint_item,
runs=self.ui.runs_spin.text(),
me=self.ui.me_spin.text(),
pe=self.ui.pe_skill_combo.currentIndex())
I'd do it this way:
blueprint = Blueprint(
self.blueprint_map[str(self.ui.blueprint_combo.currentText())],
runs=self.ui.runs_spin.text(),
me=self.ui.me_spin.text(),
pe=self.ui.pe_skill_combo.currentIndex())
Anywhere within the brackets should work, such as:
blueprint = Blueprint(self.blueprint_map[str(self.ui.blueprint_combo.currentText())],
runs=self.ui.runs_spin.text(), me=self.ui.me_spin.text(),
pe=self.ui.pe_skill_combo.currentIndex())
blueprint = Blueprint(self.blueprint_map[str(self.ui.blueprint_combo.currentText())],
runs=self.ui.runs_spin.text(), me=self.ui.me_spin.text(),
pe=self.ui.pe_skill_combo.currentIndex())
精彩评论