tags:

views:

163

answers:

5

Hello Stack Overflow,

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 advance

+1  A: 

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())
neil
+9  A: 
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(),
)
kender
+1  A: 
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())
Wim
+3  A: 

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())
Agos
+6  A: 

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())
gnibbler