# '^' does not behave as expected - moderator (because it is pow and not XOR)

**URL:** <https://discourse.julialang.org/t/does-not-behave-as-expected-moderator-because-it-is-pow-and-not-xor/81916>\
**Category:** New to Julia\
**Created:** [May 30, 2022, 2:24pm UTC](https://discourse.julialang.org/t/does-not-behave-as-expected-moderator-because-it-is-pow-and-not-xor/81916 "2022-05-30T14:24:02Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hagbard.1930](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hagbard.1930/32/36757_2.png) [@Hagbard.1930](https://discourse.julialang.org/u/Hagbard.1930)\
**Post date:** [May 30, 2022, 2:24pm UTC](https://discourse.julialang.org/t/does-not-behave-as-expected-moderator-because-it-is-pow-and-not-xor/81916/1 "2022-05-30T14:24:02Z")

</div>

![image](https://global.discourse-cdn.com/julialang/original/3X/d/8/d80869a4c4364f010d6f65292b2b161d1f4b4f49.png)

---

<div class="post-metadata">

**Author:** ![lungben](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lungben/32/12314_2.png) [@lungben](https://discourse.julialang.org/u/lungben)\
**Post date:** [May 30, 2022, 2:26pm UTC](https://discourse.julialang.org/t/does-not-behave-as-expected-moderator-because-it-is-pow-and-not-xor/81916/2 "2022-05-30T14:26:52Z")

</div>

What is wrong here?

---

<div class="post-metadata">

**Author:** ![cormullion](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cormullion/32/49131_2.png) [@cormullion](https://discourse.julialang.org/u/cormullion)\
**Post date:** [May 30, 2022, 2:35pm UTC](https://discourse.julialang.org/t/does-not-behave-as-expected-moderator-because-it-is-pow-and-not-xor/81916/3 "2022-05-30T14:35:06Z")

</div>

```python
Python 2.7.18 (default, Oct 2 2021, 04:20:39) 
[GCC Apple LLVM 13.0.0 (clang-1300.0.29.1) on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> x = -3
>>> x^2
-1

```

🙂

---

<div class="post-metadata">

**Author:** ![lungben](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lungben/32/12314_2.png) [@lungben](https://discourse.julialang.org/u/lungben)\
**Post date:** [May 30, 2022, 2:38pm UTC](https://discourse.julialang.org/t/does-not-behave-as-expected-moderator-because-it-is-pow-and-not-xor/81916/4 "2022-05-30T14:38:33Z")

</div>

The difference is that `^` is the power operator in Julia, whereas it is the XOR operator in Python (`**` is the Python power operator).

See [Noteworthy Differences from other Languages · The Julia Language](https://docs.julialang.org/en/v1/manual/noteworthy-differences/#Noteworthy-differences-from-Python)

---

<div class="post-metadata">

**Author:** ![skleinbo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/skleinbo/32/36080_2.png) [@skleinbo](https://discourse.julialang.org/u/skleinbo)\
**Post date:** [May 30, 2022, 2:43pm UTC](https://discourse.julialang.org/t/does-not-behave-as-expected-moderator-because-it-is-pow-and-not-xor/81916/5 "2022-05-30T14:43:33Z")

</div>

I’ve taken the liberty to change the title to something a little more informative, and move the thread into a more appropriate category.
