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 3 years have passed since last update.

Python to RubyAdvent Calendar 2021

Day 16

[py2rb] itertools.chain

Last updated at Posted at 2021-12-21

はじめに

移植やってます

itertools.chain (Python)

import itertools

for i in itertools.chain([x.end() for x in re.finditer(rule, sequence)], [None]):

extendと似ていますが、こちらは平坦化も行っています。

flatten (Ruby)

[sequence.scan(rule).map { sequence.index(_1) + _1.size } + [nil]].flatten.each do |i|
end

平坦化といえばflatten

メモ

  • Python の itertools.chain を学習した
  • 道のりは遠そう
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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?