0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

はじめに

移植やってます。
( from python 3.7 to ruby 2.7 )

直列化 (Python)

import pickle
self.assertEqual(dict_, pickle.loads(pickle.dumps(dict_)))

オブジェクトと、オブジェクトを直列化しさらに復元されたオブジェクトを比較していますが、Equal にならないこともあるのでしょうかねえ?

直列化 (Ruby)

assert_equal dict_, Marshal.load(Marshal.dump(dict_))

独習Ruby 330p

7.2.7 オブジェクトのシリアライズ

ここでは、dumpをオーバーライドして特定のデータのみシリアライズする例が紹介されています。

メモ

  • Python の 直列化 を学習した
  • 百里を行く者は九十里を半ばとす
0
0
0

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?