Q:

Is it possible to have an if inside a tuple?

I'd like to build something like:
A = (
  'parlament',
  'queen/king' if not country in ('england', 'sweden', …),
  'press',
  'judges'
)

Is there any way to build a tuple like that?
I tried
'queen/king' if not country in ('england', 'sweden', …) else None,
'queen/king' if not country in ('england', 'sweden', …) else tuple(),
'queen/king' if not country in ('england', 'sweden', …) else (),

but nothing is working, there doesn't seem to be an tuple-None-element, so I have a 3-tuple for all countries beside England, Sweden, etc. for which I get a 4-tuple

A:

Yes, but you need an else statement:
>>> country = 'australia'
>>> A = (
...   'parlament',
...   'queen/king' if not country in ('england', 'sweden') else 'default',
...   'press',
...   'judges'
...      )
>>> print A
('parlament', 'queen/king', 'press', 'judges')

Another example:
>>> country = 'england'
>>> A = (
...   'parlament',
...   'queen/king' if not country in ('england', 'sweden') else 'default',
...   'press',
...   'judges'
...    )
>>> print A
('parlament', 'default', 'press', 'judges')

This is a conditional expression, otherwise known as a ternary conditional operator.

A:

can propose You following
A = (('parlament',) +
     (('queen/king',) if not country in ('england', 'sweden', …) else tuple()) +
     ('press', 'judges'))

this allows You to include or not include elements in result tuple (unlike default value, which will be included if You will not use tuple concatenation.
A = ('parlament',
     'queen/king' if not country in ('england', 'sweden', …) else 'default',
     'press', 'judges')

