That example would surely be better as:
something = myfunc(d['x']) if 'x' in d else None something = myfunc(d['x']) if 'x' in d else NoneIn any event don't optimize prematurely and use a profiler rather than guessing if performance is an issue. ;-)