# What's this code mean?

**URL:** <https://discuss.pytorch.org/t/whats-this-code-mean/62171>\
**Category:** Uncategorized\
**Created:** [November 26, 2019, 2:25am UTC](https://discuss.pytorch.org/t/whats-this-code-mean/62171 "2019-11-26T02:25:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![a\_new\_pytorcher](https://discuss.pytorch.org/letter_avatar_proxy/v4/letter/a/5daacb/32.png) [@a\_new\_pytorcher](https://discuss.pytorch.org/u/a_new_pytorcher)\
**Post date:** [November 26, 2019, 2:25am UTC](https://discuss.pytorch.org/t/whats-this-code-mean/62171/1 "2019-11-26T02:25:45Z")

</div>

[1\>\>d & 1 for d in range(10)][::-1]

---

<div class="post-metadata">

**Author:** ![Eta\_C](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/eta_c/32/17667_2.png) [@Eta\_C](https://discuss.pytorch.org/u/Eta_C)\
**Post date:** [November 26, 2019, 2:36am UTC](https://discuss.pytorch.org/t/whats-this-code-mean/62171/2 "2019-11-26T02:36:43Z")

</div>

Just some simple bit operations, see [here](https://wiki.python.org/moin/BitwiseOperators)

```python
[d for d in range(10)] -> [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
[1 >> d for d in range(10)] -> [1, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[1 >> d & 1 for d in range(10)] -> [1, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[1 >> d & 1 for d in range(10)][::-1] -> [0, 0, 0, 0, 0, 0, 0, 0, 0, 1]

```

---

<div class="post-metadata">

**Author:** ![a\_new\_pytorcher](https://discuss.pytorch.org/letter_avatar_proxy/v4/letter/a/5daacb/32.png) [@a\_new\_pytorcher](https://discuss.pytorch.org/u/a_new_pytorcher)\
**Post date:** [November 26, 2019, 2:38am UTC](https://discuss.pytorch.org/t/whats-this-code-mean/62171/3 "2019-11-26T02:38:56Z")

</div>

thank you,i am a green hand,and dont know a lot about it .
