2
3

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

python > link > range() / xrange()

Last updated at Posted at 2016-10-11

TensorFlowというDeep Learning関連のもので、pythonコードを学習中。
https://www.tensorflow.org/versions/master/tutorials/mnist/tf/index.html#tensorflow-mechanics-101

http://qiita.com/7of9/items/e184bde61545da9267c5
において気になったrange()とxrange()について。

xrangeの方が早いですね。必要に応じて値を取り出しているからなのでしょうか。
但し、メモリは間違いなくxrangeが少ないので、メモリを大量消費する場面ではxrangeを使っていきましょう。

メモリ使用効率が違うということらしい。

xrangeを使います。

2
3
1

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
2
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?