LoginSignup
0
0

More than 1 year has passed since last update.

はじめに

移植やってます。

namedtuple (Python)

Protein = namedtuple('Protein', ('description', 'sequence'))

独習Pythonでは、辞書やクラスでも代替できると書いてあります。

Struct (Ruby)

Protein = Struct.new(:Protein, :description, :sequence)
p1 = Protein.new('abc', 'setumei', 'ATGC')
puts p1.description

【初心者向け】順番に意味がある配列はハッシュに置き換えように親切な解説があります。

ただし今回は、これだとp1.p2...p99とか大量発生しそうな気も

Hash (Ruby)

protein = {}
protein[:abc] = { description: 'setmei', sequence: 'ATGC'}
puts protein[:abc][:description]

今回は、これにしようかな

メモ

  • Python の namedtuple を学習した
  • 道のりは遠そう
0
0
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0