# Playing With the Idea of \`pass\` as an Expression

**URL:** <https://discuss.python.org/t/playing-with-the-idea-of-pass-as-an-expression/102311>\
**Category:** Ideas\
**Created:** [August 13, 2025, 11:11pm UTC](https://discuss.python.org/t/playing-with-the-idea-of-pass-as-an-expression/102311 "2025-08-13T23:11:50Z")\
**Posts on this page:** 1\
**Showing post:** 25

<div class="post-metadata">

**Author:** ![adqm](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/adqm/32/28615_2.png) [@adqm](https://discuss.python.org/u/adqm)\
**Post date:** [August 15, 2025, 1:01am UTC](https://discuss.python.org/t/playing-with-the-idea-of-pass-as-an-expression/102311/25 "2025-08-15T01:01:34Z")

</div>

I’ve been thinking about this a little bit more today, and I pretty much agree with what I _think_ is the general consensus in the thread:

- Some form of this idea is useful, and
- narrowing the scope (conditional expressions only, and only in certain contexts) would get rid of a lot of the weird cases and make it a lot more palatable.

There is still a question of where exactly this thing should be allowed/disallowed. Looks like there’s broad agreement about:

- Single items in literal list/set/tuple displays: `[..., x, y if condition else pass, z, ...]`
- Full key/value pairs in literal dict displays: `{..., k: v if condition else pass, ...}`
- Keyword arguments: `foo(..., x, a=b if condition else pass, y=z, ...)`

And some other things that might be more divisive\[1\]:

- Positional arguments: `foo(..., x if condition else pass, ...)`
- Unpackings of various kinds:
  - `[..., x, *y if condition else pass, z, ...]`
  - `foo(x, y, **d if condition else pass)`

- Others?

* * *

Separately, the more I look at this, the more I think that syntax like `x if condition() else pass`_does_ suggest that `pass` is a normal expression of some kind, rather than a keyword.

I’m still oscillating, but I think right now I prefer @15r10nk’s suggestion from [the thread I linked in a footnote above](https://discuss.python.org/t/26567), which is to allow omitting the `else` clause from conditional expressions in some situations, rather than allowing `pass` to be used inside of conditional expressions in some situations, so instead of:

```python
my_tuple = (
    "first_item",
    "second_item" if condition else pass,
    "third_item",
)

```

we would have:

```python
my_tuple = (
    "first_item",
    "second_item" if condition,
    "third_item",
)

```

And instead of:

```python
foo(
    a=1,
    b=2,
    c=3 if condition else pass,
)

```

we would have:

```python
foo(
    a=1,
    b=2,
    c=3 if condition,
)

```

This loses the `pass` idiom as an explicit indicator that we’re excluding something, but to my eyes it’s just as clear, and with quite a bit less typing 🙂. Of course, we could also make the `else pass` optional to mirror the way you can always add an `else: pass` to a conditional statement right now.

* * *

1. I quite like these though 🙂

---

_[View the full topic](https://discuss.python.org/t/playing-with-the-idea-of-pass-as-an-expression/102311)._
