Mailinglist Archive: yast-devel (246 mails)

< Previous Next >
Re: [yast-devel] Re: [yast-commit] <rest-service> master : Revert "introduction to use dbus service"
  • From: Martin Kudlvasr <mkudlvasr@xxxxxxx>
  • Date: Wed, 26 Aug 2009 13:09:56 +0200
  • Message-id: <200908261309.56455.mkudlvasr@xxxxxxx>
On Tuesday 25 August 2009 17:18:38 Klaus Kaempf wrote:
* Michal Zugec <mzugec@xxxxxxxxxxxxxxxxxxxxxxxxxx> [Aug 25. 2009 17:09]:

+ dev.id = s.split("\t")[0]
+ dev.name = s.split("\t")[1]

Its more readable (and more Ruby like) to have id and name as
'constructor' arguments:

Network::Device.new id, name

And these assignments are wasting cycles as you're splitting the string
two times.

dev.id, dev.name = s.split

You can assign to several variables at once. Also split splits on any
whitespace by default.

Martin Kudlvasr


Klaus
---
SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG N├╝rnberg)

--
To unsubscribe, e-mail: yast-devel+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-devel+help@xxxxxxxxxxxx

< Previous Next >
References