Remark 21.11. Expanding Against Vacuum.
What happens if there is a vacuum outside the gas container and the container of the gas is punctured so that the gas can freely flow into the vacuum?
In this situation, the gas would not be in a mechanical equilibrium. Hence, you cannot assign any pressure to the entire gas. However, since, there would be no force opposing the movement of the gas molecules, the gas molecules would not do any work on any outside body. The molecules will, of course do work on each other if interactions between molecules are significant. In the case of an ideal gas interactions between molecules are assumed to be absent.
\begin{equation}
W_{if} = 0 \ \ \ \text{(expanding in vacuum.)}\tag{21.8}
\end{equation}