# Poll: Python-style ternary operator (was: Syntax polls)

**URL:** <https://discourse.julialang.org/t/poll-python-style-ternary-operator-was-syntax-polls/792>\
**Category:** Internals & Design\
**Created:** [December 7, 2016, 9:49pm UTC](https://discourse.julialang.org/t/poll-python-style-ternary-operator-was-syntax-polls/792 "2016-12-07T21:49:38Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![pitao](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pitao/32/116_2.png) [@pitao](https://discourse.julialang.org/u/pitao)\
**Post date:** [December 7, 2016, 10:04pm UTC](https://discourse.julialang.org/t/poll-python-style-ternary-operator-was-syntax-polls/792/3 "2016-12-07T22:04:06Z")

</div>

# Python-style ternary operator: `a if pred else b`

Arguments in favour:

- It does not have to be learned. A nonprogrammer can parse it.
- syntax highlighting will split `a` and `b` very nicely, as the keywords will be a different colour.
- it reads naturally. (i.e. it conforms to our natural language). ‘Pythonic’.

Arguments against:

- people are familiar with `?:`
- `?:` is fewer characters

My preference would be to have both available. When concision is paramount, use `?:` otherwise use `_ if _ else _`.

_Poll ([view on site](https://discourse.julialang.org/t/poll-python-style-ternary-operator-was-syntax-polls/792/3))_

---

_[View the full topic](https://discourse.julialang.org/t/poll-python-style-ternary-operator-was-syntax-polls/792)._
